Skip to content

Instantly share code, notes, and snippets.

@erikerlandson
Created March 29, 2014 19:11
Show Gist options
  • Save erikerlandson/9861055 to your computer and use it in GitHub Desktop.
Save erikerlandson/9861055 to your computer and use it in GitHub Desktop.
dump sizes of atomic numeric types in c/c++
#include <iostream>
using namespace std;
#define showsize(tname) cout << #tname << ": " << sizeof(tname) << endl
int main(int argv, char** argc) {
showsize(char);
showsize(short);
showsize(int);
showsize(long);
showsize(long long);
showsize(float);
showsize(double);
showsize(long double);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment