Does changing the order of class private data members breaks ABI

Posted by Dmitry Yudakov on Stack Overflow See other posts from Stack Overflow or by Dmitry Yudakov
Published on 2010-05-31T15:00:21Z Indexed on 2010/05/31 15:03 UTC
Read the original article Hit count: 342

I have a class with number of private data members (some of them static), accessed by virtual and non-virtual member functions. There's no inline functions and no friend classes.

class A
{
    int number;
    string str;
    static const int static_const_number;

public:
    // got virtual and non-virtual functions, working with these memebers
    virtual void func1();
    void func2();

    // no inline functions or friends
};

Does changing the order of private data members breaks ABI in this case?

class A
{
    string str;
    static const int static_const_number;

    int number; // <--   integer member moved here
    ...
};

© Stack Overflow or respective owner

Related posts about c++

Related posts about shared-libraries