Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c
Subject: Re: Coding style for small if statements
Date: Sun, 16 Feb 2020 05:55:36 -0800
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <86k14mfxgn.fsf@linuxsc.com>
References: <20200131234613.59047e037939ceb549b8e6d6@gmail.com> <9951ac5f-a84c-4dde-87cd-c2bcaf5afb89@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: reader02.eternal-september.org; posting-host="5afe6ca82d77f883ab9def33834e0994"; logging-data="6778"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19BfLVSMyuwM1HBjEnxKRjomqsWT4CV3o8="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:+b/Suk0uDoTqpkmcHK/q6G/Niyg= sha1:uQIj+7vVJceh526Z5ZCplSyuJeM=
Xref: csiph.com comp.lang.c:150048
Malcolm McLean writes:
> On Friday, 7 February 2020 14:25:28 UTC, Guillaume wrote:
>
>> Small digression:
>> Not to trigger a flamewar here, I know this is a topic for potentially
>> heated debate here (coding style almost always is), but I personally
>> just hate the opening braces at the end of lines. This style has become
>> pervasive. I think it initially comes from the Kernighan & Richie style,
>> which granted were the authors of C, but we have to keep in mind that in
>> the 70's, screen estate was really at a premium, so it saved extra
>> lines.
>
> K and R were producing a printed book. In print, the matched brace with
> the brace the only thing on the line style looks typographically odd, as
> well as consuming paper.
The first point is debatable, but in any event neither of these
factors influenced the way code was written in K&R, which was
written the same way they had for years been used to writing
their own programs.