This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gnu software bugs - shift left


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]