On 2016-04-04 04:35, Gavin Lambert wrote:
On 3/04/2016 02:08, Andrey Semashev wrote:
I guess, I could extract all members other than 'data' to a separate union and then:
union function_buffer { mutable function_buffer_members m; mutable char data[sizeof(function_buffer_members)]; };
This would require more modifications to the code though.
(Sigh... if only we could inherit unions...)
Could you do this with an anonymous union? eg:
union function_buffer { mutable union function_buffer_members { ... }; mutable char data[sizeof(function_buffer_members)]; };
Haven't tested this; not sure if it's legal to get the sizeof a subtype nested in the same scope like this, but it at least seems plausible.
That is a named union in your example. And if it's anonymous then you have no name to apply sizeof to.