This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: unsigned / double propagation weirdness?
Andrew Pinski wrote:
The reason is that -i*dm really is (-i)*dm which is really
((double)(-i))*dm.
So it turns out to be ((unsigned int)-1) * 1.0 which is different from
-(double)(1) * 1.0.
So it just misunderstanding on where the unary operator, -, applies to
and when the cast
happens.
Indeed. I would be interested in exactly what warning is being proposed,
since you certainly don't want to regard the use of unary minus on
unsigned as something you warn about. Basically this error is one of
precedence, and I have a hard time seeing what warning might reasonably
be generated in this case.