{ Coding can of worms }
18-Feb-91 23:43:37
Sb: #7702-{ Coding can of worms }
Fm: Don Curtis/SYSOP 76703,4321
To: Jane R. Hansen 72377,3621
Jane,
The closing brace for the function goes at the left edge…as does
the opening brace for the function. Other braces have the opening brace at
the end of the line containing the for, while, switch, if, etc. statements.
Closing braces go even with the start of the for, while, switch, if, etc.
statement like this:
|<—- presume this is the left edge of your screen
my_funct(a,b,c)
int a,b;
char c;
{ /* opening brace of
function */
/* local vars */
int counter;
for (counter = a; counter < b ; counter++ ) { /* open for
*/
do_something(c);
if (check_something(counter)) { /* open if
*/
foo(global_var);
break;
} /* close if
*/
do_some_more();
} /* close
for */
} /* close function */
again…this is MY preference. You and others may not like it, and
that's fine. The important thing is to select a style you are comfortable
with, but once you find that style…keep it uniform. I noticed an earlier
message from you where you saw mixed styles in one program. That's
generally a bad coding practice…at least for me…it makes things very
difficult to follow.
Don