1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Word line classes

Discussion in 'C' started by priyatendulkar, Jul 26, 2011.

  1. priyatendulkar

    priyatendulkar New Member

    Joined:
    Jun 20, 2011
    Messages:
    20
    Likes Received:
    1
    Trophy Points:
    0
    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?
     
  2. Scripting

    Scripting John Hoder

    Joined:
    Jun 29, 2010
    Messages:
    421
    Likes Received:
    57
    Trophy Points:
    0
    Occupation:
    School for life
    Location:
    /root
    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.
     
  3. priyatendulkar

    priyatendulkar New Member

    Joined:
    Jun 20, 2011
    Messages:
    20
    Likes Received:
    1
    Trophy Points:
    0
    Hello Scripting,

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

Share This Page