On Feb 4, 2012, at 2:27 PM, Joerg Sonnenberger wrote:

> On Sat, Feb 04, 2012 at 11:53:28AM -0500, Howard Hinnant wrote:
>> But I note the crux of this issue appears to be that this:
>> 
>>   static const intmax_t nan = (1LL << (sizeof(intmax_t) * CHAR_BIT - 1));
>> 
>> is no longer consider a compile time constant expression.
> 
> Ignoring the question of whether clang should allow that or not, why
> aren't you using the more compact statement below, which is just as
> portable:
> 
> static const intmax_t -~(intmax_t)0;


That gives the value 1.  These expressions are forming the value 
0x8000000000000000.

That being said, I have no doubt that this can be fixed in libc++.  It won't be 
easy, because this issue occurs in many more places than just <ratio>.  And I 
actually haven't decided how I would fix it.  But I'm sure it can be done.

The real issue is that I believe this code to be sufficient common as to 
irritate a sufficient number of customers.  And this despite the fact that the 
code is well-defined on all hardware clang will ever target.  On modern 
platforms there is only a left shift, not a signed left shift and unsigned left 
shift.  Or if there is a distinction, the two are synonyms.

Howard

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to