|
From: Tom H. <th...@cy...> - 2003-11-03 09:53:30
Attachments:
valgrind-c99-patch
|
A change made yesterday introduced a variable declaration that isn't at the start of a block which stops the code compiling on older versions of gcc that don't have C99 support. The attached patch fixes this. Tom -- Tom Hughes (th...@cy...) Software Engineer, Cyberscience Corporation http://www.cyberscience.com/ |
|
From: Nicholas N. <nj...@ca...> - 2003-11-03 11:14:59
|
On Mon, 3 Nov 2003, Tom Hughes wrote: > A change made yesterday introduced a variable declaration that isn't > at the start of a block which stops the code compiling on older > versions of gcc that don't have C99 support. The attached patch > fixes this. Committed, thanks. 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? And is there a command-line option I can give to prevent me from accidentally using non-block-starting declarations? Thanks. N |
|
From: John L. <le...@mo...> - 2003-11-03 14:26:23
|
On Mon, Nov 03, 2003 at 11:14:58AM +0000, Nicholas Nethercote 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) regards john -- Khendon's Law: If the same point is made twice by the same person, the thread is over. |
|
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 |