Re:Tagged unions, or ‘variants’, in C
by OskarS on Monday June 26, 2017 @09:08AM
(#14636446)
I'm not a C programmer, but isn't there some directive you can add to a union to tightly pack it, or specify member memory locations or something? So that then you could guarantee that for the Some struct, `ptrdiff_t tag;` starts at offset 0 and the union starts at offset `sizeof(ptrdiff_t)`?
[ Parent
| on HN ]