Word line classes

priyatendulkar's Avatar, Join Date: Jun 2011
Go4Expert Member
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?
0
Scripting's Avatar, Join Date: Jun 2010
John Hoder
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.
0
priyatendulkar's Avatar, Join Date: Jun 2011
Go4Expert Member
Hello Scripting,

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