[Top][All Lists]

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

Re: -Wdeclaration-after-statement

From: Ben Pfaff
Subject: Re: -Wdeclaration-after-statement
Date: Sat, 17 Dec 2011 21:46:08 -0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Hmm.  What if, for now, we leave in the single
declaration-after-statement that is currently in the tree, trying
not to add more, and see whether we get problem reports between
now and the release of the next PSPP version?

John Darrington <address@hidden> writes:

> I have mixed feelings.
> On the one hand, I do like to be able to declare variables after some
> dependent varible has been calculated, because otherwise it's sometimes
> impossible to give a const qualifier, when one clearly is warranted.
> {
>  int x, y;
>  init_xy (&x, &y);
>  const double z = x / (double) y;
>  /* I don't want z to change after this point */
> }
> On the otherhand, I'm not quite so convinced that C99 is as widespread
> as soem people think.  Only last week I was scratching my head for an hour
> or so over an error thrown up by a Keil compiler which turned out to be
> exactly this issue.
> On Wed, Dec 14, 2011 at 09:00:56PM -0800, Ben Pfaff wrote:
>      I've had PSPP enable -Wdeclaration-after-statement for a long
>      time now, because declarations following statements are not
>      entirely portable.
>      However, I've noticed that you are fond of writing code this way.
>      GNU coreutils contains some code that writes declarations after
>      statements, too, which indicates that support must be pretty
>      widespread.  So, I'm thinking about dropping the warning and
>      stopping worrying about a portability problem here; it probably
>      isn't a real problem any longer.
>      Any comments?
>      Thanks,
>      Ben.
>      -- 
>      Ben Pfaff 

Ben Pfaff

reply via email to

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