This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Integral conversions in C/C++
Christian BÃhme wrote:
> Andrew Haley wrote:
>
>>> That was the whole point of the OP (Did you read the subject ?).
>>
>> Unfortunately I did. yes.
>
> Yet you keep going. Why ?
To try to discover the substance of the complaint, if any.
>> The operands, and the result, are all of type unsigned int, which
>> presumably is 32 bits in this case.
>
> And given that integral promotions according to [conv.prom] only
> promote as far as to unsigned int as the type with the highest
> conversion rank, where was there intergal promotion applied,
> again ?
It's not: the operands are unsigned int, and stay that way.
>> So what? The compiler does what the standard says it must.
>
> Which was the actual incentive for the OP.
I thought you were complaining about the compiler, not the standard.
>> Right: the compiler can use such an instruction, but it must discard
>> the upper part of the result.
>
> And _here_ is where the standard screws up.
In your opinion.
>> "The correct result"? The correct result is whatever the standard
>> says it is.
>
> However counter-intuitive to anyone knowing what linear algebra is it
> may possibly seem.
That's right.
Andrew.