bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [POLL] C99, declaration after statement


From: Gary V. Vaughan
Subject: Re: [POLL] C99, declaration after statement
Date: Sun, 25 Sep 2011 15:14:23 +0700

Hi Paul,

On 25 Sep 2011, at 13:09, Paul Eggert wrote:

> On 09/24/11 22:31, Gary V. Vaughan wrote:
>> $ cc -o hello hello.c
>> cc-1241 cc: ERROR File = hello.c, Line = 7
>>  A declaration cannot appear after an executable statement in a block.
> 
> You're supposed to use cc's -c99 flag, no?
> Or compile with c99?  Then declarations after statements
> should work; see, for example
> <http://lists.gnu.org/archive/html/bug-gnulib/2009-02/msg00241.html>.

D'oh!  Quite right.

There must be some side effect that -c99 has which prevents me from just
turning it on indiscriminately... Unfortunately I don't remember what, only
that I've had to go through adding braces to make extra scopes around out
of order declarations.

I'll keep an eye out for an example and post it here when I find it.

> Is 'configure' not doing this for you automatically?
> If so, then let's fix that.

How will configure know whether it needs to use -c99 mode or not?  I tend
to set CC and CFLAGS per host/compiler pair anyway, so I wouldn't notice
if configure is trying to pick the flags for me.

Cheers,
-- 
Gary V. Vaughan (gary AT gnu DOT org)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]