jeudi 5 mai 2016

why is sizeof() returning 24 bytes instead of 16?

I have the following lines of code:

#include <iostream>
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/random.hpp>
#include <time.h> 
using namespace boost::multiprecision;
using namespace boost::random;

int main() {


  time_t timer;

  typedef independent_bits_engine<mt19937, 128, uint128_t> generator_type;
  generator_type gen;


  gen.seed(time(&timer));
  uint128_t a = gen();

  std::cout << a << std::endl;
  std::cout <<sizeof(a) << std::endl;

 }

Shouldn't my randomly generated number a be 128 bits, which is 16 bytes? (Since 8*16 = 128)?

The answer I get when I do sizeof(a) is 24. Why?




Aucun commentaire:

Enregistrer un commentaire