3 ms·
Well, for one, unions have defined behavior in C, while passing pointers around and casting them randomly doesn't. I don't know if this is the best example. Ge
by theseoafs 11y ago
Well, for one, unions have defined behavior in C, while passing pointers around and casting them randomly doesn't.
I don't know if this is the best example. Generally you see unions in C to cover "tagged unions", I.e. Those things that would be subsumed by algebraic data types in other languages.
- MereInterest 11y agoAh, got it. I am used to C++, where accessing the non-active member of the union is undefined behavior. Thank you.