bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sun C++ bug with stdbool


From: Eric Blake
Subject: Re: Sun C++ bug with stdbool
Date: Fri, 16 Apr 2010 16:50:37 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100330 Fedora/3.0.4-1.fc12 Lightning/1.0b1 Thunderbird/3.0.4

On 04/16/2010 04:39 PM, Paul Eggert wrote:
> First, doesn't the stdbool module already check for this bug?  It has
> code that looks like this:
> 
>           char d[(bool) 0.5 == true ? 1 : -1];
> 
> Why does this work, while "char h[(bool)0.0==0?1:-1];" fails?

Both tests fail Solaris CC.  It's just that in test-stdbool.c, test d is
commented out with #if 0, because the gnulib replacement can't guarantee
C99 semantics, while it can guarantee the C99 semantics of test f:

char f[(_Bool) 0.0 == false ? 1 : -1];

for all reasonable C compilers (we hope).  The problem we're up against
is a broken C++ compiler.

> Second, I don' think that this particular test case is that important.
> If we understand why it doesn't work, then the simplest thing to do is
> to comment it out.  (If we don't understand it, then I'd be a little
> more cautious....)

Well, given that the test appears to be due to a bug in the Solaris
compiler (it accepts (int)0.0, and accepts (bool)0, but rejects
(bool)0.0 as constants), I'm okay with that approach.  So, the question
is now what preprocessor flags to we examine in order to skip that
particular portion of test-stdbool.c only for CC?  Or do we go full-bore
and use #if 0, skipping test f everywhere?

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]