On 2016-04-05 06:45, Gavin Lambert wrote:
Mere moments ago, quoth I:
On 4/04/2016 19:52, Andrey Semashev wrote:
On 2016-04-04 04:35, Gavin Lambert wrote:
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.
Type name != member name. It is still an anonymous union.
Although on further reflection, allowing a tag name on an anonymous union might be a Microsoft-specific extension (though GCC can enable support for it via command-line parameter).
Oh, if that's a non-standard extension then I'm not aware of it.
It's probably something that *ought* to be in the standard, but that probably doesn't help you much at this time.
I'd say it *should not* be in the standard as it is very confusing.