title: does in c++ the conversion from unsigned int to int always preserve the bit pattern?
body: <p>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:</p>
  
  <blockquote>
    <p>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 note ]</p>
  </blockquote>
  
  <p>So in this direction the conversion preserves the bitmask. I am not sure the standard guarantees the same for the conversion from unsigned int to int (again, assuming the same number of bits are used). The standard here says:</p>
  
  <blockquote>
    <p>If the destination type is signed, the value is unchanged if it can be
    represented in the destination type (and bit-ﬁeld width); otherwise,
    the value is implementation-deﬁned.</p>
  </blockquote>
  
  <p>What does it exactly mean "the destination type" here? For instance 2^32-1 cannot be represented by a 32 bit int. Does that mean that it cannot be represented in the destination type and therefore it cannot be assumed that the bit pattern will stay the same?</p>