gnu software bugs - shift left

Mischa Baars mjbaars1977@gmail.com
Sat Nov 2 19:22:00 GMT 2013


On 11/02/2013 08:17 PM, Jonathan Wakely wrote:
> On 2 November 2013 18:57, Mischa Baars wrote:
>> I understand, however it seems more logical to use the destination type to
>> determine the type of the first and second operand.
>>
>> Are you completely sure this is the desired behaviour?
> It's the behaviour required by the C standard, so yes, it is
> absolutely desirable that GCC does that.
>
> The literal 1 has a fixed type and the literal 31 has a fixed type,
> and the expression (1<<31) has a fixed type. Whether you assign the
> result to a different type does not alter those types involved in the
> expression.

Wow, that sounds pretty stupid for a standard again :)

Thanks.



More information about the Gcc mailing list