sizeof(class A) ?
x86, 32bit, почему sizeof(class A) = 1 ?
(возможно смешно, но тем не менее)
#include <stdio.h>
class A
{
public:
A();
~A();
};
int main(void)
{
printf("sizeof(class A) = %d \n", sizeof(class A));
printf("sizeof(A) =%d \n", sizeof(A));
printf("sizeof(int)=%d \n", sizeof(int));
printf("sizeof(void)=%d \n", sizeof(void));
printf("sizeof(void*)=%d \n", sizeof(void*));
}
$ g++ t.cpp
$ ./a.out
sizeof(class A) =1
sizeof(A) =1
sizeof(int)=4
sizeof(void)=1
sizeof(void*)=4
$