differences in behavior between char, signed char and unsigned char
The code below compiles successfully, but char behaves differently than integer types.
cout ::ikIsX >() ::ikIsX >() ::ikIsX >()The result is three instantiation patterns for three types: int8, uint8 and char. Why does this happen?
The same is not true for integers: int and uint32 result in one pattern instantiation, and signed int results in another.
The reason is probably because C treats char , signed char and unsigned char as three different types. While int is the same as signed int. Is this true, or am I missing something?
#include
using namespace std; typedef signed char int8; typedef unsigned char uint8; typedef signed short int16; typedef unsigned short uint16; typedef signed int int32; typedef unsigned int uint32; typedef signed long long int64; typedef unsigned long long uint64; struct TrueType {}; struct FalseType {}; template struct isX { typedef typename T::ikIsX ikIsX; }; // Это int==int32 неоднозначно //template bool getIsTrue(); template ::ikIsX >() ::ikIsX >() ::ikIsX >() ::ikIsX >() ::ikIsX >() ::ikIsX >() I use g 4.something
Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.
Copyright© 2022 湘ICP备2022001581号-3