Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Word line classes (http://www.go4expert.com/forums/word-line-classes-t26365/)

priyatendulkar 26Jul2011 11:10

Word line classes
 
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?

Scripting 26Jul2011 13:29

Re: Word line classes
 
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.

priyatendulkar 26Jul2011 14:01

Re: Word line classes
 
Hello Scripting,

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


All times are GMT +5.5. The time now is 19:58.