Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-tis!ames!mailrus!cornell!uw-beaver!fluke!ssc-vax!dmg From: dmg@ssc-vax.UUCP (David Geary) Newsgroups: comp.lang.c Subject: Re: Standard indentation? Message-ID: <2417@ssc-vax.UUCP> Date: 14 Dec 88 17:21:14 GMT References: <641@htsa.uucp> <6580@polyslo.CalPoly.EDU> Organization: Boeing Aerospace Corp., Seattle WA Lines: 51 In article <6580@polyslo.CalPoly.EDU>, cquenel@polyslo.CalPoly.EDU (Chris (i = --i++;) Quenelle) writes: > In article <641@htsa.uucp> fransvo@htsa.UUCP (Frans van Otten) writes: > > > >#define then /* as white space; see below */ > > > > if (a > 10) > > then putchar('1'); > > else putchar('2'); > > Bravo!! Me Too!! > whenever the statements are blocks, I omit the then, though. > I vote strongly for this. The symmetry scans very easily for me. ^^^^^^^^^^^^^^^^^^^^^^^^^ For you maybe, but for someone else reading your code, maybe not. One of the first things that students in my C class who are reformed ;-) Pascal programmers, want to do is this: #define BEGIN { #define END } and a whole slew of other macros to make C look like pascal. Let's say that Joe, Jim, Bob, and Phyllis are all programmers working on a C project. Joe used to program in BASIC [sic], Bob, Pascal, Jim, Fortran, and Phyllis ALGOL. So all of them spend a day or two writing macros to make their C code look like the language that their used to. Then one day, Jim needs to debug Bobs code. He's not debugging C, - he's debugging some wierd C/Pascal code, and Jim doesn't know Pascal. The moral of the story is: 1) When you write C code, you should try to make it as readable for others as for yourself. 2) If you ever have to read (or - gasp - debug) someone else's REAL C code - you're in trouble, because you don't KNOW C - you know some weird C/(insert favorite language) dialect. 3) One of the best ways to learn C is to read someone else's C code. (Even better, port it to a different machine). If you don't write "real" C, you'll have a hell of a time reading "real" C. If you want to program in C - then program in C, not psuedo-C. -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ David Geary, Boeing Aerospace, ~ ~ #define Seattle RAIN ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~