[LLVMdev] Definition of C/C++ integral conversion(was Re: nsw/nuw for trunc)

Duncan Sands baldrick at free.fr
Fri Sep 30 08:46:55 PDT 2011


>>    3) If the destination type is signed, the value is unchanged if it
>>       can be represented in the destination type (and bit-field
>>       width); otherwise, the value is implementation-defined.
>> ----------------------------------------------------
>>
>> 4.7.3 suggest to me, that the standard does not define a result for
>> '(signed char) 999'. I assume you know this section, but I could not
>> find a reason why this section should not apply in this case. Any ideas?
>
> It does apply: the value is implementation-defined, and the definition
> that any sane implementation uses is 2's complement truncation.

Right, implementation defined is not the same as undefined.

Ciao, Duncan.



More information about the llvm-dev mailing list