Re: Implementation-defined behavior or not?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 3 Jun 2019 at 11:41, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote:
>
> On Mon, 3 Jun 2019 at 10:49, esoteric escape <manips88@xxxxxxxxx> wrote:
> >
> > Thanks! I see, yes speaking of C++17. Just to make sure I grasped it I'll say how I get it:
> >
> > 1. In the std::string's case, we care about bits regardless of the value of the chars inside std::string, so because mapping is precise that makes it well-defined.
> > 2. In case of char, the underlying bit representation changes
>
> On most implementations, no. The underlying bit representation is the
> same. 0xC8 as an unsigned char is 11001000 and as a char is also
> 11001000. What is implementation-defined is the value of 11001000 as a
> char. For signed char with GCC that value is (char)-56. For an
> unsigned char it's (char)200. One a one's complement system

Sorry, that last sentence was garbled. I meant to say that on a one's
complement system that also has signed char the bit pattern of
(char)0xC8 might be different (maybe ... I don't speak one's
complement so I don't know if that's true), but that's not relevant to
GCC which always uses two's complement.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux