What is the meaning and use of the sentence "C ++ compilers use a binary object layout"

Looking through this C ++ FAQ https://isocpp.org/wiki/faq/mixing-c-and-cpp#cpp-objs-passed-to-c , I came across a statement

Most C ++ compilers use a binary object layout that causes this conversion to occur with multiple inheritance and / or virtual inheritance.

I could not understand the meaning and application of this. According to the C ++ FAQ, this object linking mechanism helps the C ++ compiler in the check below

In C ++, it is easy to check whether Derived *, called dp, points to the same object that Base *, called bp points to: just tell if (dp == bp) .... The C ++ compiler will automatically convert both in the same pointer, enter Base * in this case, and then compare them. Depending on the C ++ implementation details of the compilers, this conversion sometimes changes the bit of the pointer value.

Can anyone help to understand the binary object layout of any popular C ++ compilers and what are the possible changes and the corresponding mechanism for changes in bits of the pointer value. and how this helps in comparing Base / Derived class pointers.

Edit: Explain why the following is also valid.

: void * C ++ ! (x == y) false, (b == d) :

+4
1

" " " , , ".

++:

struct Left
{
  int ll;
};

struct Right
{
  int rr;
};

struct Derived : Left, Right
{
  int dd;
};

() :

+ Derived ----------------+
| + Left +  + Right +     |
| | ll   |  | rr    |  dd |
| +------+  +-------+     |
+-------------------------+

, 3 int s, :

+ Derived------+
| ll | rr | dd |
+--------------+

:

Derived d;
Dervied *pd = &d;
Left *pl = &d;
Right *pr = &d;

pd d, ll.

pl Left d. Left - ll. pl == pd, pd Left*. , pd ll, pd . ( ).

pr Right d. Right rr, pr rr. , pr == pd pd Right*. Right d rr, pd ll. , (= ) pd ( int), rr. , &d Derived* Right* pr .

, void* . , &d.ll != &d.rr, pl == pr.

+8

All Articles