|
|
Block StructureFrom $1Table of contentsIn order to make the source code readable always use braces around blocks, and put braces on the next line, even if it is unambiguous. Use if (foo)
{
blah();
}
else
{
bleh();
}
for (i=0; (i<imax); i++)
{
printf("Foo %d\n",i);
}
rather than: if (foo)
blah();
else
bleh();
for(i=0;i<imax;i++)
printf("Foo %d\n",i)
Note that there is an empty line between the two logical blocks ( Try to add a comment before a loop or conditional statement to tell *why* you are doing something, not what you are doing. Most users hacking the code know that Spaces are good - that's what the space-bar on your keyboard is so large :-) Personally I feel that e.g. using parentheses around the
Tags:
|