Re: The result of 1 << 32



Jordan Abel wrote:
> On 2005-10-30, Walter Roberson <roberson@xxxxxxxxxxxxxxxxxx> wrote:
> > I don't have my reference material here, but I seem to recall that
> > constant calculations are supposed to be done "as if" they were
> > done at run-time. Possibly that only applied to calculations in
> > preprocessor expressions.
>
> It does not apply to undefined behavior.
>
> > If my recollection is correct, then even though the shift
> > behaviour is undefined, would it not be required to be consistant?
>
> There are no rules which apply to undefined behavior. Were this
> unspecified or implementation-defined, that would be true.

It is not true for unspecified behaviour either. The code

foo( f(), g() );

could call f and g in different orders depending on what day
of the week it is.

.