Path: csiph.com!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!3.eu.feeder.erje.net!feeder.erje.net!news.in-chemnitz.de!news2.arglkargh.de!news.mixmin.net!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c Subject: Re: How to disambiguate macro? Date: Sat, 14 Aug 2021 23:17:32 -0700 Organization: A noiseless patient Spider Lines: 35 Message-ID: <86wnonw7sz.fsf@linuxsc.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="4dd8ce6a7e240a14eec73d2f816adcd2"; logging-data="30568"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+dg7MzTXQK9ewvEKBgZ2HzkPNPPJkRYf8=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:bSorVGIJiyn3hzfBc39LbU2XFBs= sha1:5bXFZLogj6Sq/Bc9u/2Lt+oIGfU= Xref: csiph.com comp.lang.c:162379 John Forkosh writes: > David Brown wrote: [...] >> And I recommend you get in the habit of writing : >> if (xxx) { >> setlink(a, b, c); >> } else { >> yyy; >> } >> People vary in their opinions and styles, of course, ... > > Yuk! My, but that's ugly. :) For just one statement in the > if-clause and/or else-clause, I typically wouldn't use {}'s at > all. And for just a few statements, I typically write it like > if (xxx) { > setlink(a, b, c); > getlink(d, e, f); } > else { > yyy; > zzz; } Despite your visceral reaction, the layout you suggest here is objectively inferior along at least one important axis. Studies of various rules for bracketing layout have found that lining up closing brackets (which are braces in this case) with the start of their corresponding opening lines (ie, like the quoted example recommendation) gives the lowest error rates of all the layout styles looked at (including the "lisp style" layout you suggest). The layout you prefer has higher error rates than the "ugly" layout you dislike. I think any developer who is serious about writing good code would want to follow a layout style that has lower error rates, whatever their personal reactions might be.