Liste des Groupes | Revenir à cl c |
On 11/08/2024 20:33, Tim Rentsch wrote:But, when that -1 value is converted to an unsigned type, that VALUE will be adjusted modulo the appropriate power of two.Ick. That choice is exactly backwards IMO. Converting -1 to"Converting -1 to an unsigned type always sets all the bits"
an unsigned type always sets all the bits. Converting -1u to
an unsigned type can easily do the wrong thing, depending
on the target type.
In any normal twos complement architecture that's the case. But there are a few oddballs out there where -1 is +1, except that the dedicated sign bit is set.
Andy
Les messages affichés proviennent d'usenet.