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

>> Comment to the code: please move variable definition to the start of the
function ('int chance, rate;' in get_info_label_text_popup()).
> What's the issue here? (The variables are declared at the start of a block,
so this code is not C99-only.)
Ah. I see the coding style actually says "Freeciv is programmed in plain C
with some C99 features. This means that: [...] Declaring variables in the
middle of the function body is forbidden".

So my code does transgress what is written by declaring variables at the
start of a block within a function, but so does lots of existing code (random
examples: client/tilespec.c:scan_specfile(),

Is this really the intention, or is it desired to forbid declaring variables
in the middle of a _block_ (which really is a C99-ism), for example:

  void f(void)
     int x, y; /* BAD */
     do_more_stuff(&x, &y);

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.


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to