[Top][All Lists]

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

Re: -Wdeclaration-after-statement

From: John Darrington
Subject: Re: -Wdeclaration-after-statement
Date: Sun, 18 Dec 2011 07:32:05 +0000
User-agent: Mutt/1.5.18 (2008-05-17)

Ok.  Let's do that.


On Sat, Dec 17, 2011 at 09:46:08PM -0800, Ben Pfaff wrote:
     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 
     > 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

PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See or any PGP keyserver for public key.

Attachment: signature.asc
Description: Digital signature

reply via email to

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