[Toybox] [PATCH] vi: Removed C99/GNU99 style for loop initializers

Rob Landley rob at landley.net
Sat Mar 23 14:59:14 PDT 2019


On 3/23/19 4:44 PM, Jarno Mäkipää wrote:
> Removed for(int i = 0;....) style loop initializers to be consistant
> with project style.

The project style is that variable declarations are at the start of blocks.

http://landley.net/toybox/design.html#codestyle

> Variable declarations go at the start of blocks, with a blank line between
> them and other code. Yes, c99 allows you to put them anywhere, but they're
> harder to find if you do that. If there's a large enough distance between
> the declaration and the code using it to make you uncomfortable, maybe the
> function's too big, or is there an if statement or something you can use
> as an excuse to start a new closer block?

Your second one is, your first one isn't. But it's an improvement. :)

Also, it would be easier if you could "git format-patch -1 $COMMIT" and attach
the file. (Not a huge deal, 30 seconds to apply/test/push vs about 2 minutes.)

Thanks,

Rob



More information about the Toybox mailing list