3 ms·
Unless I'm missing something by skipping straight to 5.4, the explanation of unions is hot garbage. None of the examples are sane as they are all larger than th
by unanswered 6y ago
Unless I'm missing something by skipping straight to 5.4, the explanation of unions is hot garbage. None of the examples are sane as they are all larger than the smallest array of a naturally-aligned type with the same alignment as the most-aligned field, such that this array is not smaller than the largest field in the union — which would be a structure with the same alignment and stride as the original union. (You could also "cover" it with a more precise struct which may be smaller than its own stride, which is what I think the paper was trying to explain, but the examples are still nonsense.)