| PLEX86 | ||
Thou shalt have no other gods before the ANSI C standard 1560Charlie Gibbs As a matter of style, there is no clearly "right" way to position the braces. The important thing is to pick one style and use it consistently. If it weren't for tab stops being too wide, I'd prefer for (i = 0; stri != '-0'; ++i) { * whatever * } Note that the braces are grammatically part of the controlled expression, thus ought to be indented on the following line, same as for for (i = 0; stri != '-0'; ++i) putchar(stri); Since the* whatever *is in a new block context, it deserves to be indented one space further, same as for foo(i); baz(i, 0); { int j = bar(i); if (j != i) baz(i, j); } zzz(i); Thou shalt have no other gods before the ANSI C standard 1561 Randy Howard That's one of the differences between C and PL-I. C library functions are just that. As someone... However, given wide tab stops, I generally just put the open-brace on its own line and don't ndent for the block scope. It's but one of many reasonable styles. The clbuttic "K&R" style is for(i = 0; stri; i++) { * whatever * } and it has the advantage that every C programmer ought to already be familiar with it. Because perhaps one might want to continue to use the pointer to the beginning of the string after the loop. You can of course use a new variable for the loop pointer (instead of for the index). Some compilers will generate the same code either way.
|
||||
Thou shalt have no other gods before the ANSI C standard 1561 Alt Folklore Computers from Newsgroups The #1 Usenet Provider on the Internet
Thou shalt have no other gods before the ANSI C standard 1559 |
||||