LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] c puzzle...

[ILUG] c puzzle...

Colm MacCarthaigh colm at stdlib.net
Mon May 17 12:38:31 IST 2004


On Mon, May 17, 2004 at 12:33:31PM +0100, kevin lyda wrote:
> i should point out that the ;; is the problem, but that it will not fail
> to compile/run on rh7.3 if the ;; were on these statements:

That's because you define a variable after what is effectively a
statement on the first line. All variable declaration have to come
at the start of a block, so when you have int i;;  you have;

	int i;
	/* empty statment */ ;
	char *s;

But you can't define a variable after a statement. In the below
examples ...

> 
>     char *s = "hello world\n";;
> 
> or
> 
>     printf("%d %s", i, s);;


it makes no difference, because statements can always come after
statements :) It's just an inconsistency in that one compiler
considers ;; just ignorable, and the other (more properly imo)
considers it an empty statement.

-- 
Colm MacCárthaigh                        Public Key: colm+pgp at stdlib.net



More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell