According to the C++23 standard, what is the output of this program?
#include <iostream>
#include <type_traits>
int main() {
if(std::is_signed<char>::value){
std::cout << std::is_same<char, signed char>::value;
}else{
std::cout << std::is_same<char, unsigned char>::value;
}
}The answer is different for the case of int and signed int.
0
Plain char, signed char, and unsigned char are three distinct types.
§[basic.fundamental]¶7 in the standard:
Type
charis a distinct type that has an implementation-defined choice of “signed char” or “unsigned char” as its underlying type.