All pastes #4662 Raw Edit

Anonymous

public text v1 · immutable
#4662 ·published 2005-01-24 02:36 UTC
rendered paste body
#include <iostream>
#include <sys/types.h>

class foo {
    u_int8_t a;
};

class bar {
    float a[3];
};

class foobar {
    u_int8_t a;
    float b[3];
};

int main(){
        //1, correct
        std::cout << "Sizeof foo: " << sizeof(foo) << '\n';
        //12, correct
        std::cout << "Sizeof bar: " << sizeof(bar) << '\n';
        //16, in-memory size =(
        std::cout << "Sizeof foobar: " << sizeof(foobar) << '\n';
        return 0;
}