Does source incompatibility always mean binary incompatibility?

Any examples showing that the original compatibility is broken, but binary compatibility is supported.

+3
source share
3 answers

Old version:

struct inner {
  int bar;
}

struct foo {
  struct inner i;
};

void quux(struct foo *p);

A new version:

struct inner2 {
  int bar;
};

struct foo {
  struct inner2 i;
};

void quux(struct foo *p);

Broken code:

struct foo x;
struct inner *i = &x.i;
i->bar = 42;
quux(&x);

Since the only difference is the name of the structure, and the name of the internal type structure is erased at compile time, there is no binary incompatibility.

+5
source

, , , B, B. , .

0

, (, long int). - , . ( -.NET , C/++ .)

0

Source: https://habr.com/ru/post/1714179/


All Articles