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

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:


  Nachricht geschickt von/durch Gna!

Freeciv-dev mailing list

Reply via email to