In C++ the problem is simple.
I have 2 classes one contains the other as part of its implementation.
struct A
{
void do_something()
{
};
};
struct B
{
A obj_A;
void hello_world()
{
};
};
Now the problem is that structure B is one byte larger if A is part of B when I do a sizeof(B) and object of type B. A is 100% only going to include only non-virtual members (no virtual table required) and there is no need for a typeid check. Is there any way (like a compiler directive) to completely remove the unneeded byte from B but still access A's member function through B?
I can only assume the extra byte is a compiler added char* to A's name "A" but any other ideas can be helpful.