Let's I have a class `class Drawable`. It could have many members, member functions, parent classes, or could be very simple. For the sake of this example that is not important. Also, let's say it is some kind of GUI element.
Then, let's assume I have a rendering engine, which is provided as a GCC library `engine.a`. That library contains `class Screen`, which has method `void Screen::add(const Drawable & child)`. All I have are headers and library itself. In my application I instantiate `Screen`, create few `Drawable` objects and `add` them to `Screen`.
My questions:1. Could my GCC toolchain (or my GCC toolchain's version) create different memory layout for `Drawable` objects than in compiled `engine.a`? Standard does not define it and it is an implementation detail. Either way it will link perfectly. How can I know that and how can I be sure about correct behaviour?
2. Is this implemenation detail is a question of ABI?
This question is about compiler internals ONLY.
P. S. I mostly use ARM GCC toolchain for Cortex-M architecture, but my question is not limited to that.
P. P. S. If you have any thoughts related, but not related to GCC specifically, please feel free to share.
View all questions in GNU Toolchain forum