|
From: Nicholas N. <nj...@ca...> - 2003-11-04 10:25:27
|
On Mon, 3 Nov 2003, John Levon wrote: > > I don't understand gcc's C99 support; it lets me do some things (such as > > declarations not at the start of a block) without any command line args, > > but other things, eg. "for (int i = 0; ...)" requires -std=c99. Why is > > this? > > -std=xx means "accept code meeting that standard". "-pedantic[-errors]" > is what changes whether non-standard code is accepted or not. > > > And is there a command-line option I can give to prevent me from > > accidentally using non-block-starting declarations? > > -Wdeclaration-after-statement (in gcc 3.4) Hmm... -pedantic gives hundreds of warnings about code that is non-standard C89 (eg. we use "long long", C++ "//" style comments, variadic macros, zero-length arrays, etc etc etc). But using -Wdeclaration-after-statement will break with pre-3.4 versions of gcc (including 3.2.2, my own copy!) Frustrating. N |