From: Ralph Corderoy <firstname.lastname@example.org>
Subject: [COFF] Formatting of Expressions. (Was: Re: FD 2)
Date: Wed, 01 Feb 2023 09:36:31 +0000 [thread overview]
Message-ID: <20230201093631.704E921E5F@orac.inputplus.co.uk> (raw)
> > I'll never do if (a==b&&c==d), always if ((a==b)&&(c==d)).
> Indeed; I *always* use parentheses even if they are not necessary (for
> my benefit, at least).
I find unnecessary parenthesis annoying and clutter which obscures
reading. If parenthesis are used only when overriding the default
precedence then this beneficially draws attention to the exception.
I doubt mandatory parenthesis are used in maths formulas by those that
use them in expression.
Whitespace is beneficial in both maths formulas and expressions. The
squashed expression above will often be spaced more.
if (a==b && c==d)
if (a == b && c == d)
Go's source formatter will vary which operators get spaces to reflect
precedence, e.g. https://go.dev/play/p/TU95Oz57GuF shows ‘4*3’ differs.
fmt.Println(4 * 3)
fmt.Println(5 ^ 4*3)
fmt.Println(5 ^ 4*3 + 2/1.9)
parent reply other threads:[~2023-02-01 9:36 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <alpine.BSF.email@example.com>]
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).