By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,388 Members | 1,823 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,388 IT Pros & Developers. It's quick & easy.

something about gcc3.4.2

P: n/a
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)

Dec 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"us******@gmail.com" <us******@gmail.com> writes:
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
--
Dag-Erling Smørgrav - de*@des.no
Dec 21 '05 #2

P: n/a
Dag-Erling Smørgrav wrote:
"us******@gmail.com" <us******@gmail.com> writes:
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 full story can be found in the GCC manual:
http://gcc.gnu.org/onlinedocs/gcc-3....ialect-Options

S.
Dec 21 '05 #3

P: n/a
"us******@gmail.com" <us******@gmail.com> writes:
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.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Dec 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.