[Prog] C and curly braces - question of style?
aec
brat at magma.ca
Sun Aug 22 19:17:41 EST 2004
On Mon, Aug 23, 2004 at 12:55:20AM +0200, Finne Boonen wrote:
>
> style of curly braces? I'm confused :)
> Do you mean where you place the {} or do you mean the actual looping
> construct(for, while)?
Sorry, I should learn to be precise :) I meant placement of {}
>
> why is the second example more difficult for you?
> for me it's more difficult because of the way the braces are placed,
>
> wich is the way I prefer it (wastes more lines, but is a lot more readable imho)
The second example is more difficult to read quickly, for the same
reason you mentioned. I can not, at a glance, see what code is
contained within a block whereas:
for (a = 0; a < 10; ++a)
{
[.......some code.....]
}
is much clearer to me. I am happy you all responed with the
opinion I'd hoped for :)
> but onto the real issue, for loops are ussually prefered over while
> loops because you have the increment (++number), the ending
> condition(number <=15) and the initial condition(number=1) are
> conveniently placed together. You have less chance of forgetting one
> of them.
>
> Finne
Indeed onto the real issues... I hope you guys dont mind
an avalanche of questions to follow :)
--
Angelina Carlton
More information about the Programming
mailing list