if (e1) return e2; [else] s1;
Chris Lang
chrisl at caen.engin.umich.edu
Sat Mar 24 11:06:00 AEST 1990
In article <887 at dino.cs.iastate.edu> hascall at cs.iastate.edu (John Hascall) writes:
> I'm not sure which of the above is better, but I am sort of
> "stuck on" the following convention:
>
> if (e1) s1; \
> --or-- \
> if (e1) { | Does this seem reasonable?
> s1; | (ignoring whether or not the `{'
> } | belongs on the next line or not)
> --but never-- |
> if (e1) /
> s1; /
I'm probably not one to be talking about style, but... I agree. In fact,
I go so far as to never use the first form (almost). I also like to spread
things out a little more, so it looks more like:
if (spam->flags | EATEN)
{
Barf();
} /* if */
else
{
OnlyGetQueasy();
} /* else */
The third form I never use, since I otherwise find myself forgetting to enclose
's1' in braces if I go back and add a second statement. (I will use it on
rare occasions in long lists of if/elseif/else's where I am 99.9% sure I will
not be adding any other statements, since otherwise they'd take up way too much
much room, especially given my style of indentation and { placement...)
OTOH, I change my style often enough that if you asked me this question six
months from now, I'd probably vehemently criticize such a preposterous
proposition. :-)
-Chris
--
Chris Lang, University of Michigan, College of Engineering +1 313 763 1832
4622 Bursley, Ann Arbor, MI, 48109 chrisl at caen.engin.umich.edu
WORK: National Center for Manufacturing Sciences,
900 Victors Way, Suite 226, Ann Arbor, MI, 48108 +1 313 995 0300
"I hate quotations. Tell me what you know." - Ralph Waldo Emerson
More information about the Comp.lang.c
mailing list