Article View: comp.lang.c++
Article #797Re: does an expression in a logical statement need parenthesis for proper evaluation?
From: Andrey Tarasevich
Date: Mon, 09 Nov 2026 07:32
Date: Mon, 09 Nov 2026 07:32
27 lines
2031 bytes
2031 bytes
On Thu 11/5/2026 3:42 PM, Lynn McGuire wrote:
> Does an expression in a logical statement need parenthesis for proper
> evaluation in C and/or C++?
>
> In other words, should
>
> if (j1 * i1 < 1) {
> goto L463;
> }
>
> be
>
> if ((j1 * i1) < 1) {
> goto L463;
> }
>
The whole `j1 * i1 < 1` is an expression in this case. It is parsed in
accordance with the grammar, which ultimately makes it equivalent to
`(j1 * i1) < 1`.
Your question seems to suggest that the `j1 * i1` part somehow qualifies
as an expression, while the rest of it does not. That's not how it
works. The language does not give the `j1 * i1` part any special status.
--
Best regards,
Andrey
Technical Details
Message-ID:
<11crsub$11ikc$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11cj4a0$23796$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Andrey Tarasevich <noone@noone.net> Newsgroups: comp.lang.c++,comp.lang.c Subject: Re: does an expression in a logical statement need parenthesis for proper evaluation? Date: Sun, 8 Nov 2026 23:32:25 -0800 Organization: A noiseless patient Spider Lines: 27 Message-ID: <11crsub$11ikc$1@dont-email.me> References: <11cj4a0$23796$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 09 Nov 2026 07:32:28 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1100428"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19d9y+TMv8zr4etVI8AgpNS"; posting-host="1b766ed91c1a6df0160e25d52cc613ce" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:x4yt4aF8NbdS7VXiP9opbnXAJ08= sha256:2Eg5E4RBpWIeCcouDhHO5eVXIF5aY/WABSox3xlSW1Q= sha1:AAkJwDsk15sEbJDmAu9EiRFaRNY= sha256:mamT94b5tYcVgqgFbNyEljCwnnohCwCWtigtRX0VdPI= Content-Language: en-US In-Reply-To: <11cj4a0$23796$1@dont-email.me>