// ----------------
// BuiltInTypes.c++
// ----------------
#include <cassert> // assert
#include <cstddef> // ptrdiff_t, size_t
#include <iostream> // cin, cout, endl
int main () {
using namespace std;
cout << "BuiltInTypes.c++" << endl;
assert(sizeof(bool) == 1);
assert(sizeof(char) == 1);
assert(sizeof(short) == 2);
assert(sizeof(int) == 4);
assert(sizeof(long) == 8);
assert(sizeof(long long) == 8); // not standard!
assert(sizeof(size_t) == 8); // unsigned long
assert(sizeof(ptrdiff_t) == 8); // signed long
assert(sizeof(float) == 4);
assert(sizeof(double) == 8);
#ifdef __APPLE__
assert(sizeof(long double) == 16);
#else
assert(sizeof(long double) == 12);
#endif
cout << "Done." << endl;
return 0;}
syntax highlighted by Code2HTML, v. 0.9.1