🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#773
From: Lynn McGuire
Date: Fri, 06 Nov 2026 22:34
57 lines
3439 bytes
On 11/6/2026 3:48 PM, Steven G. Kargl wrote:
> 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.

I found the ISO C binding to be lacking and not type safe to my standard.

I also was not enthusiastic about installing it in thousands of places 
in my code.

Lynn
Technical Details
Message-ID: <11clklo$2uvic$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> <11clhvc$2t2j1$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: Lynn McGuire <lynnmcguire5@gmail.com>
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 16:34:29 -0600
Organization: A noiseless patient Spider
Lines: 57
Message-ID: <11clklo$2uvic$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> <11clhvc$2t2j1$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 06 Nov 2026 22:34:33 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="3112524"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19OuYSL8WtueNmV5r4r5MSmZUq9/bvKbv0="; posting-host="9424d41671042b4b3ea15a90032ad150"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:iX7cvIqILPKp4dwG7IgYIJ0ZzSA= sha256:n7B+imKoz9vG3HSvCfMIV5Eooc2ORmvbul/+BQUkFRM=
	sha1:W57oe5kQZlWSr7ygvvNZAOHSGEA= sha256:9Zn2ChExmNVCqstmnGP4n7TNia2b7JO6UG5wXYJWXU8=
In-Reply-To: <11clhvc$2t2j1$1@dont-email.me>
Content-Language: en-US