Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Standard Indentation etc. Message-ID: <9179@smoke.BRL.MIL> Date: 14 Dec 88 22:39:32 GMT References: <663@htsa.uucp> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 25 In article <663@htsa.uucp> fransvo@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).