🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c++
Article #770

Re: does an expression in a logical statement need parenthesis for proper evaluation?

#770
From: Steven G. Kargl
Date: Fri, 06 Nov 2026 21:48
51 lines
3081 bytes
On Fri, 6 Nov 2026 15:37:33 -0600, Lynn McGuire wrote:

> On 11/6/2026 12:50 PM, Keith Thompson wrote:
>> David Brown <david.brown@hesbynett.no> writes:
>>> On 06/11/2026 02:07, Lynn McGuire wrote:
>>>> On 11/5/2026 5:42 PM, Lynn McGuire wrote:
>>>>> Hi,
>>>>>
>>>>> 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;
>>>>> }
>>>>>
>>>>> Thanks,
>>>>> Lynn
>>>> Thank you all very much.  BTW, there were parenthesis in the old
>>>> Fortran code but F2C stripped them out.  I put them back in for my
>>>> comfort as I see them.
>>>>
>>>
>>> Since you are generating the C++ code automatically, there should not
>>> be a problem adding the parentheses.  Generated code that contains
>>> "goto L463" is clearly not intended for humans anyway (at least, not
>>> without a good deal of effort).
>> 
>> My understanding is that the C++ code being generated is intended to be
>> maintained as C++ code.  Lynn can confirm or deny that.  He's using f2c
>> and a lot of manual cleanup.
> ...
> 
> Yes.  I am tired of fixing the thousands of Fortran to C calls and C to 
> Fortran calls when we move to a new Fortran compiler or a new C/C++ 
> compiler.  This is one of the problems that has kept us on the obsolete 
> Watcom F77/C/C++ compilers for over 30 years.
> 

Fortran's ISO C binding feature fixed this Fortran <--> C issue some
20 years ago.  Granted, CFI was not available until 2018.

-- 
steve
Technical Details
Message-ID: <11clhvc$2t2j1$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-mail
References: <11cj4a0$23796$1@dont-email.me> <11cj994$24m06$1@dont-email.me> <11ck0pr$2amtc$1@dont-email.me> <11cl7i3$2pbh3$1@kst.eternal-september.org> <11clhb0$2tpii$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: "Steven G. Kargl" <sgk@REMOVEtroutmask.apl.washington.edu>
Newsgroups: comp.lang.c++,comp.lang.c
Subject: Re: does an expression in a logical statement need parenthesis for
 proper evaluation?
Date: Fri, 6 Nov 2026 21:48:28 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 51
Message-ID: <11clhvc$2t2j1$1@dont-email.me>
References: <11cj4a0$23796$1@dont-email.me> <11cj994$24m06$1@dont-email.me>
	<11ck0pr$2amtc$1@dont-email.me> <11cl7i3$2pbh3$1@kst.eternal-september.org>
	<11clhb0$2tpii$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 06 Nov 2026 21:48:29 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3050081"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19giDIrlNe9SsgOEz2tGyr0"; posting-host="7e2b11870dde811dd21900fc47f6f44c"
User-Agent: Pan/0.164 (Kupiansk)
Cancel-Lock: sha1:XG3uOWgGyidVD7jk2mdQwwgvM64= sha256:aGMx1zXsNeWWJLUJs95RrPxM8Vkp8b1usG/p0imyBkk=
	sha1:UqZI4MiwQ+VsHPjfoiCwPYVM0p0= sha256:qKg99zoCBP0a1eqJk7/3Ep+eolvcgS9RiFa1gCKfmi8=