does in c++ the conversion from unsigned int to int always preserve the bit pattern?
问题 From the standard (4.7) it looks like the conversion from int to unsigned int, when they both use the same number of bits, is purely conceptual: If the destination type is unsigned, the resulting value is the least unsigned integer congruent to the source integer (modulo 2 n where n is the number of bits used to represent the unsigned type). [ Note: In a two’s complement representation, this conversion is conceptual and there is no change in the bit pattern (if there is no truncation). — end