From: David Lecomber <david@streamline-computing.com>
To: gdb@sources.redhat.com
Subject: Boolean equality (C++/Fortran)
Date: Fri, 03 Sep 2004 14:53:00 -0000 [thread overview]
Message-ID: <1094224351.31231.59.camel@cpc4-oxfd5-5-0-cust12.oxfd.cable.ntl.com> (raw)
In valarith.c:value_binop, where v1 and v2 have been established to be
values of type bool, we have:
case BINOP_EQUAL:
v = v1 == v2;
break;
case BINOP_NOTEQUAL:
v = v1 != v2;
break;
Isn't this wrong? If you are mixing your compilers, then, at least for
Fortran, the actual value of true can vary (1 or -1 I have so far
seen). For C++ this is less likely to happen, and so far as I can tell
changing the above would not harm anything.
Does anyone have any comments on replacing the above with:
case BINOP_EQUAL:
v = !((!v1 && v2) || (v1 && !v2));
break;
case BINOP_NOTEQUAL:
v = (!v1 && v2) || (v1 && !v2);
break;
d.
next reply other threads:[~2004-09-03 14:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-03 14:53 David Lecomber [this message]
2004-09-07 17:26 ` Jim Blandy
Reply instructions:
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1094224351.31231.59.camel@cpc4-oxfd5-5-0-cust12.oxfd.cable.ntl.com \
--to=david@streamline-computing.com \
--cc=gdb@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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 read-only IMAP folder(s) and NNTP newsgroup(s).