Elektrine lite

← Feed

@mos_8502@studio8502.ca

Post #3824791

2026-07-15 03:29 UTC

Adding “-fms-extensions” to CFLAGS enables a Microsoft extension to C: anonymous tagged struct and union members. For example: struct foo { struct bar; // note the tag but no name uint64_t baz; }; The declared struct here imports all members of struct bar into struct foo as if they were part of it. I think this belongs in the C standard myself.

Replies (1)

  • @busterb@infosec.exchange 2026-07-15 04:52

    @mos_8502@studio8502.ca thinking about it, I'd still want a name, and maybe the ability to refer to the nested members directly. Otherwise, how do you refer to that part of the struct for passing into functions that take the nested type as an argument? Copying from a similar type? You'd have to copy every member one at a time. I suppose you could cast but would that guarantee the same padding and alignment rules?

    Open ##3824790