fork download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4. #define SHOW_SIZE_ALIGNMENT(T) ( std::cout << "type: " << #T << " size: " \
  5.   << sizeof(T) << " alignment: " << std::alignment_of<T>::value << '\n' )
  6.  
  7. int main()
  8. {
  9. SHOW_SIZE_ALIGNMENT(double) ;
  10. SHOW_SIZE_ALIGNMENT(long double) ;
  11. }
  12.  
Success #stdin #stdout 0s 2896KB
stdin
Standard input is empty
stdout
type: double  size: 8  alignment: 8
type: long double  size: 12  alignment: 4