From: Florian Weimer <fw@deneb.enyo.de>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: libc-alpha@sourceware.org
Subject: Re: [PATCH] assert: Support types without operator== (int) [BZ #21972]
Date: Fri, 18 Aug 2017 16:59:00 -0000 [thread overview]
Message-ID: <87o9rchkz5.fsf@mid.deneb.enyo.de> (raw)
In-Reply-To: <1b0d8b27-96f4-20d8-4cbb-47828cff8157@cs.ucla.edu> (Paul Eggert's message of "Fri, 18 Aug 2017 08:34:51 -0700")
* Paul Eggert:
> Florian Weimer wrote:
>> + ((void) sizeof (static_cast<bool> (expr)), __extension__ ({ \
>
> Can we instead replace 'sizeof ((expr) == 0)' with 'sizeof !(expr)'?
> That works in C, and if it also works in C++ it would avoid the need
> for the #ifdef __cplusplus.
It does not work in C++ because operator! could have been overloaded
or deleted. It is likely that a future C++ standard will only require
that the expression can be contextually converted to bool, and this is
what the static_cast approach relies upon.
next prev parent reply other threads:[~2017-08-18 16:59 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 15:26 Florian Weimer
2017-08-18 15:34 ` Paul Eggert
2017-08-18 16:59 ` Florian Weimer [this message]
2017-08-18 17:30 ` Paul Eggert
2017-08-18 17:41 ` Florian Weimer
2017-08-18 18:28 ` Florian Weimer
2017-08-18 19:17 ` Paul Eggert
2017-08-18 19:57 ` Florian Weimer
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=87o9rchkz5.fsf@mid.deneb.enyo.de \
--to=fw@deneb.enyo.de \
--cc=eggert@cs.ucla.edu \
--cc=libc-alpha@sourceware.org \
/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).