[Geany-devel] ANN: Configurable build beta in trunk

Thomas Martitz thomas.martitz at xxxxx
Tue Aug 25 21:50:24 UTC 2009

On 25.08.2009 22:53, Enrico Tröger wrote:
> I wonder what's about the variable i in the outer for loop, is it
> initialised at all?
> Additionally, I noticed the FOREACH_GEANYBUILDCMD_ENTRY () macro which,
> erm, looks weird. It defines an usual for loop which also uses a
> variable i. From my experience, I'd say such things can easily lead to
> weird errors and makes the code less readable.

This FOREACH_GEANYBUILDCMD_ENTRY is from a patch of mine what added the 
working dir field.

Looping though the enum GeanyBuildCmdEntries members saves a shitload of 
duplicated code, since often the very same stuff is done for the label, 
command and working dir field of the config dialog. The macro is just to 
make it more obvious. The loop is used 13 times alone.

The code is much more readable due to that IMO, and is actually much 
less error prone than not looping through the enum.

Finally, it doesn't use a variable i, it uses the variable you pass to it.

Best regards.

More information about the Devel mailing list