Word line classes

Go4Expert Member
26Jul2011,11:10   #1
priyatendulkar's Avatar
hi,

I want to know whether compiler implements bits padding in Classes as in structs??

eg:
if my struct is

struct info
{
char c;
int i;
};
Size of this structure would be 8 and not 5..(considering int is 4 bytes)


On similar grounds if my class is
class info
{
public:
char c;
int i;
};
Size of this class would be 8 always?
John Hoder
26Jul2011,13:29   #2
Scripting's Avatar
the first one's size is 5 not 8 and the 2nd one's size is also 5 i think, 'couse public doesn't change anything.
Go4Expert Member
26Jul2011,14:01   #3
priyatendulkar's Avatar
Hello Scripting,

Thanks for the reply..
However,the size of structure would be 8 as 3 bytes would be padded after "char c" member