a style question
Atsushi Kanamori
kanamori at Neon.Stanford.EDU
Mon Oct 1 03:29:17 AEST 1990
In article <1990Sep30.050655.13212 at zoo.toronto.edu> henry at zoo.toronto.edu (Henry Spencer) writes:
>In article <7341 at darkstar.ucsc.edu> aryeh at cash.uucp (the over worked C something or another) writes:
>>Since I going to be doing my first team effort I want to know if this is bad
>>style:
>> for(x=0;x!=100;x++) ...
>
>Most people find it more readable with a bit of space and the statement
>on the next line:
>
> for (x = 0; x != 100; x++)
> ...
>
>The cautious would also recommend `x <= 100', but in this situation that
>is arguable.
I would say "x <= 100" is arguably bad.
"x < 100" is more like it.
More usefully, "<" seems to be a more common idiom than "!=" in upward counting
loops. So using "<" will probably shave a few microseconds off
the human reader's processing time.
More information about the Comp.lang.c
mailing list