Standard Indentation etc.

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Dec 15 08:39:32 AEST 1988


In article <663 at htsa.uucp> fransvo at htsa.UUCP (Frans van Otten) writes:
-Doug Gwyn writes:
->   ... but it's wrong.  Consider
->        if (a > 10)
->          then putchar('1');
->               something();
->          else putchar('2');
->               somethingElse();
[Frans rejoinder:]
-Sorry Doug, must I really tell you ? C programmers should know that
-compound statements should *always* be surrounded by {}. When I see
-something like this, I always look twice because I can't see *any*
-{ or } at all.
[More Gwyn quote:]
->Steve Bourne used a lot of (more elaborate and more correct) macro
->definitions to make his C source code look more like Algol.  He was
->nearly universally cursed for having done so.

Well, ExCUSE me!  I thought you were trying to make "then" work
the way it does in languages that have it, not just be a totally
useless piece of clutter.  If you want to see how to make it
work right (a la Bourne), check out the last page of Chapter 2 of
"C Traps and Pitfalls" by Andrew Koenig (Addison-Wesley 1989)
ISBN 0-201-17928-8.  That is an EXCELLENT book for anyone who
uses C (except perhaps for old C gurus, who have already had to
figure this all out the hard way).



More information about the Comp.lang.c mailing list