Implementation-defined behavior or not?

esoteric escape manips88@gmail.com
Mon Jun 3 09:07:00 GMT 2019


Hello, I am on Windows OS where CHAR_BIT == 8.

I am trying to understand whether this behavior is implementation-defined
or not.

I have this string in UTF-8, and I am trying to understand if it is
implementation-defined:

std::string s = u8"€";

It's clear to me that char c = 0xC8 is implementation defined for the
reasons:
1. char's signedness depends on compiler..
2. If the value is beyond the representatable range of char say, -128 to
127, then again it is implementation-defined.

In the same way, I am trying to understand how the std::string case is
handled because its also uses char.

So, € in UTF-8 means E2 82 AC sequence of bytes in hex. If std::string uses
suppose signed version of char, don't they fall beyond the representable
range and therefore, their value is implementation defined in std::string?
Or, is this case actually well-defined?



More information about the Gcc-help mailing list