Follow-up Comment #8, bug #15563 (project freeciv):

> Personally I think that reducing scope of variables in blocks (as permitted
in C90) rather than piling them up at the top of the function increases
clarity, but I'll go with whatever the local style is.

I read this as follows but I'm new to this and it is my interpretation of the
text.

If there is a block due to _if_, _for_ etc. variables can be declared inside
if they are only needed there. But there should be no new block without such
a statement.


void foo()
{
  int bar1; /* good */

  for (bar1 = 0; bar1 < 10; bar1++) {
    int bar2; /* OK */
    /* use bar2 only here */
  }

  {
    int bar3; /* bad */
    /* ... */
  }
}


This is especially valid for short functions.


    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?15563>

_______________________________________________
  Nachricht geschickt von/durch Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to