Sujet : Re: Which code style do you prefer the most?
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.cDate : 05. Mar 2025, 05:21:59
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vq8jh8$29are$1@dont-email.me>
References : 1 2 3 4
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 04.03.2025 17:01, bart wrote:
[ big snip of possible and personal style preferences ]
(That is, when you have to use braces; generally I don't like that style
of syntax *because* there are so many placement styles: there are
multiple ways of writing the three tokens of '} else {'; not so many if
it's just the single token 'else'.)
Right, not so many. But still there are options.
if (c)
this();
else
that();
if (c) this();
else that();
if (c) this();
else that();
if (c) this(); else that();
And then, what do you do if there's another statement to be added in
either of the branches? You'll then have to bite the bullet use braces
anyway! And then, again yet more style choices; only put braces around
the new compound statement or using a "complete" (bracing everything)
style?
My post is not suggesting any specific [personal/preferred] style. Just
pointing out that because of the unavoidable multitude there should be
some style guideline.
Janis