#{ Coding can of worms }
18-Feb-91 01:24:51
Sb: #7687-#{ Coding can of worms }
Fm: Don Curtis/SYSOP 76703,4321
To: Jane R. Hansen 72377,3621
Jane,
I prefer the so-called UNIX standard method of using braces and
indents:
if (a == b) {
do_something();
do_anotherthing();
}
for ( i = 0 ; i < 99 ; i++ ) {
do_something_else(i);
}
while (a < b) {
a += c;
c += d;
}
and so forth. Note that the for loop above doesn't require braces
at all since there's only a single statement enclosed within them; however,
I belive it's good coding practice and makes the code more readable.
The reason I use that form of bracing rather than the :
for (i = 0 ; i < 99 ; i++ )
{
do_something_else():
}
(likewise with the others)
is that that is the way I learned it, it's the way the example code
is given in K&R (the original definition of the language) and I personally
find it much more readable, neat and clean.
Obviously, others find different methods just as readable, neat and
clean to them. In the end, it's strictly a matter of personal taste.
Don