It seems the following is guaranteed to pass (asked already here):
#include <type_traits>
static_assert(!std::is_same_v<char, signed char>);
static_assert(!std::is_same_v<char, unsigned char>);
To quote cppreference
[
char
] has the same representation and alignment as eithersigned char
orunsigned char
, but is always a distinct type
Is it also guaranteed that int8_t
and uint8_t
are defined in terms of the explicitly signed types not defined in terms of char
, and therefore also form a set of 3 distinct types with char
?
#include <cstdint>
#include <type_traits>
static_assert(!std::is_same_v<char, int8_t>);
static_assert(!std::is_same_v<char, uint8_t>);