CompuServe Messages

#C coding style

    24-Jul-89 21:30:20
Sb: #58251-#C coding style
Fm: Chris Gray 74007,1165
To: George Brickner 70040,104
You realize of course that indentation styles are a matter of religion? The ONE CORRECT WAY to write a 'do-while' in C is: do { statements; } while (condition); 1) there is no point in using a separate line for the braces – they are intimitely bound to the statement itself (after all, NOONE does compound statements without braces!) The indentation structure is quite obvious in the above. 2) there is a space between the 'while' and the '(' – this is to make it NOT look anything like a function call. 3) there is no space between the '(' and the condition, etc. Such extra space is wasteful of trees 4) the indentation is 4 characters each. This allows a reasonable number of levels without running past 80 columns In case you hadn't guessed, this is my personal opinion only, and nearly every programmer I have ever met has a different style of doing this!!!