#define then (was: Standard indentation?)
Doug Gwyn
gwyn at smoke.BRL.MIL
Sat Dec 10 09:50:35 AEST 1988
In article <6580 at polyslo.CalPoly.EDU> cquenel at polyslo.CalPoly.EDU (Chris (i = --i++;) Quenelle) writes:
>>#define then /* as white space; see below */
>> if (a > 10)
>> then putchar('1');
>> else putchar('2');
>I vote strongly for this. The symmetry scans very easily for me.
It might be "easy", but it's wrong. Consider
if (a > 10)
then putchar('1');
something();
else putchar('2');
somethingElse();
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. Finally at least the
Bourne shell sources were straightened out; I don't know whether
the "adb" sources were ever fixed.
The consensus among experienced C users today is to not try to make
the source code look like it's written in some other programming
language, but rather to use C's native control constructs. That way
any person who knows C can immediately understand the control
structure of your source code, whereas if you introduce a lot of
special syntactic sugar, they would have to first puzzle that out
before they could reliably understand your source code.
More information about the Comp.lang.c
mailing list