something about gcc3.4.2

U

usr.root

i have done a test like this with gcc3.4.2:
int main(){

for(int i =0;i<3;i++);

return 0;
}
if i complile my code without using -std=c99,it shows a message :'for'
loop initial declaration used outside C99 mode .
i wonder that if not use -std=c99,which std it compile with?how can i
find that out?
(if i use -std=c99,it's ok)
 
?

=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=

i wonder that if not use -std=c99, which std it compile with? how
can i find that out?

GNU C, which can be more or less accurately described as C89 with
extensions.

The problem with declarations in the initialization part of a for loop
is that GCC had a similar feature with slightly different semantics
before it was standardized. Code that relies on those semantics will
either not compile or produce different results with -std=c99, so the
GCC maintainers have decided to deprecate the old extension.

DES
 
K

Keith Thompson

i have done a test like this with gcc3.4.2:
int main(){

for(int i =0;i<3;i++);

return 0;
}
if i complile my code without using -std=c99,it shows a message :'for'
loop initial declaration used outside C99 mode .
i wonder that if not use -std=c99,which std it compile with?how can i
find that out?
(if i use -std=c99,it's ok)

That's a question about gcc, not about the C language. You'll find
the answer in the extensive documentation that's provided with gcc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top