Subject: Re: several messages
To: None <cgd@pa.dec.com, tv@NetBSD.ORG>
From: Ross Harvey <ross@teraflop.com>
List: netbsd-bugs
Date: 04/21/1998 11:30:16
> -- Todd Vierling (Personal tv@pobox.com; Bus. todd_vierling@xn.xerox.com):
>
> On Tue, 21 Apr 1998 ivanenko@ctpa03.mit.edu wrote:
>
> > if(condition)
> > if(condition)
> > statement;
> > else
> > statement;
>
> This block should have at least one set of braces (for the outer if
> statement) because it is ambiguous in older K&R C compilers--hence the
> warning. Not that we will be using older K&R C compilers, but it is good
> practice to clarify an else block.
No, it was never ambiguous. The document that came with early Dennis
Ritchie C compilers was very thin, but it did precisely specified that
an else is associated with the most recent elseless if statement. Since
day 1 there has been a clear meaning for this and the language was intended
to support this kind of style. In fact, since relatively little _was_
specified back then, it was even more clear. That old document could
easily be memorized. The spec lives on in section 3.6.4.1 of ANSI
X3.159-1989, and in whatever it is in the 1997 ISO/ANSI thing.
I'm not completely happy about buying in to all of the gnu style
enforcements, although this one is certainly not the worst of them.
But can you really trust people on style who think indents should go like:
if (xyz)
{
stuff
}
else
{
more stuff
}
??