#include <iostream>
using namespace std;
union types{
char Char;
short Short;
int Int;
long int LongInt;
long long int LongLongInt;
long Long;
long long LongLong;
__int128 Int128;
float Float;
double Double;
long double LongDouble;
};
int main()
{
types T;
cout << "Integer types:\n";
cout << "\tchar = " << sizeof(T.Char) << " bytes\n";
cout << "\tshort = " << sizeof(T.Short) << " bytes\n";
cout << "\tint = " << sizeof(T.Int) << " bytes\n";
cout << "\tlong int = " << sizeof(T.LongInt) << " bytes\n";
cout << "\tlong long int = " << sizeof(T.LongLongInt) << " bytes\n";
cout << "\tlong = " << sizeof(T.Long) << " bytes\n";
cout << "\tlong long = " << sizeof(T.LongLong) << " bytes\n";
cout << "\t__int128 = " << sizeof(T.Int128) << " bytes\n";
cout << "Real types:\n";
cout << "\tfloat = " << sizeof(T.Float) << " bytes\n";
cout << "\tdouble = " << sizeof(T.Double) << " bytes\n";
cout << "\tlong double = " << sizeof(T.LongDouble) << " bytes\n";
return 0;
}
Integer types:
char = 1 bytes
short = 2 bytes
int = 4 bytes
long int = 8 bytes
long long int = 8 bytes
long = 8 bytes
long long = 8 bytes
__int128 = 16 bytes
Real types:
float = 4 bytes
double = 8 bytes
long double = 16 bytes
long int == long long int == long == long long Почему? где 128 бит? gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)