B
BartC
I understand that when C does arithmetic on mixed signed/unsigned operands,
it will perform an unsigned operation (converting the signed value as best
it can to unsigned). That is, after mixed width operands have been taken
care of.
Is this actually correct, and if so what is the rationale behind that?
(I'm in the middle of a compiler for a similar language, and have to choose
between doing the same as C, using signed arithmetic instead (as this could
be more useful for typical values that would be encountered), or possibly
reporting an error).)
it will perform an unsigned operation (converting the signed value as best
it can to unsigned). That is, after mixed width operands have been taken
care of.
Is this actually correct, and if so what is the rationale behind that?
(I'm in the middle of a compiler for a similar language, and have to choose
between doing the same as C, using signed arithmetic instead (as this could
be more useful for typical values that would be encountered), or possibly
reporting an error).)