4 ms·
One of the way to achieve encapsulation in C, is to have a certain definition of a structure in the implementation file, that you use internally, and a differen
by ekr 10y ago
One of the way to achieve encapsulation in C, is to have a certain definition of a structure in the implementation file, that you use internally, and a different (usually smaller, sometimes no structure at all, just a handle), exposed to the public (in the header).
As far as I can see, this would break this approach, (if this strict type aliasing would also be used at LTO).
- gpderetta 10y agoIn C++ this already breaks the One Definition Rule at compile time, even before any aliasing issues come into play. I'm not sure what's the ODR equivalent in C (or whether it exists at all).