Sujet : Re: Which code style do you prefer the most?
De : rjh (at) *nospam* cpax.org.uk (Richard Heathfield)
Groupes : comp.lang.cDate : 04. Mar 2025, 23:17:34
Autres entêtes
Organisation : Fix this later
Message-ID : <vq7u5u$21gol$2@dont-email.me>
References : 1 2 3 4 5 6
User-Agent : Mozilla Thunderbird
On 04/03/2025 21:49, Richard Harnden wrote:
<snip>
I like the brace on its own line. It visually separates the condidition from the statement.
Agreed.
How do people format long and complex conditions, given that you're trying not to a much over 80 columns?
I like to break after a binary operator so that it is syntactically obvious that the line must continue:
if((a != b &&
c != d &&
e != f) ||
(g = h() * i() &&
(j = k))
{
foo();
}
(You'll be glad to hear that that's not a direct quote!)
-- Richard HeathfieldEmail: rjh at cpax dot org dot uk"Usenet is a strange place" - dmr 29 July 1999Sig line 4 vacant - apply within