[Vm-dev] about generating long long min literal...

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Mon Mar 16 00:14:37 UTC 2015


2015-03-16 1:12 GMT+01:00 Nicolas Cellier <
nicolas.cellier.aka.nice at gmail.com>:

>
>
> 2015-03-16 0:52 GMT+01:00 Nicolas Cellier <
> nicolas.cellier.aka.nice at gmail.com>:
>
>>
>>
>> 2015-03-15 3:36 GMT+01:00 Andres Valloud <
>> avalloud at smalltalk.comcastbiz.net>:
>>
>>>
>>> So how about keeping a copy of C99 handy?  Whenever you suspect a
>>> compiler bug, see if you can use it to prove the compiler wrong. Obviously
>>> compilers are not flawless, but it really helps to rule out cases of
>>> garbage-in, garbage-out.
>>>
>>>
>> Hi Andres
>>
>> For -1LL<<63, it's more readable for sure, but not more portable, see
>>
>> http://stackoverflow.com/questions/3784996/why-does-left-shift-operation-invoke-undefined-behaviour-when-the-left-side-oper
>>
>>
> Oops, I missread this one too...
> -1LL<<63 seems correct.
>

Ah no, it's UB, time to go to get some rest...


>
>
>> For reading the C standard, I often take a shorter path: the question
>> must have been raised on SO ;)
>> This time I consulted gcc bug reports, and several were including this
>> constant, thus my incorrect analysis at first.
>> But for sure, the chances of discovering a bug is really tiny compared to
>> the chances of miss-interpreting the standard!
>>
>> Nicolas
>>
>> On 3/13/15 16:47 , Nicolas Cellier wrote:
>>>
>>>> Ah, ah, it's not a gcc bug, it's just one another C pitfall...
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20150316/88d5e048/attachment-0001.htm


More information about the Vm-dev mailing list