Hi folks,
As I code practice projects from my C book, there are many times where the author recommends using or not using braces, and earlier in the book gave a few examples of how different programmers might indent the case statements in a switch.
It's been indicated that whitespace, as well as comments, are ignored by the compiler. So, this leaves quite a bit of leeway for ways of arranging the code.
My question is how do you guys & gals who have been programming forever handle braces? I've tried the following:
The examples in the book follow the frootloops style. The IDE I'm using, CC386 IDE (switched to it from Pelles because Pelles gave me errors typing in C89 style) defaults to the juicyfroot style. The fuzzy style I have seen in some of the other books I've looked at.Code:frootloops {
milk {
cookies;
}
}
juicyfroot
{
shinyfoil
{
gum;
}
}
hoolaloops
{ dizzy
{ spinning;
}
}
fuzzy
{
wuzzy
{
wuzzabear;
}
}
However, I seem to like the hoolaloops style, which I found accidentally by backspacing. I can follow the vertical trail of braces and keep track of which nest I'm in, and having the line of the next nest on the same line as the first braces seems to save a little space.
I know it's probably just a question of personal taste, but I do think it's important. Several books have mentioned how important it is to clearly name identifiers, and pick a readable, consistent style for nesting and braces.
So, any thoughts are appreciated!
Thanks,
DT