3 ms·
What's even stupider is that I'd be willing to bet it's also UB. If it is, it means an ISO-C-compliant compiler is allowed to generate code that does absolutel
by gwd 6y ago
What's even stupider is that I'd be willing to bet it's also UB. If it is, it means an ISO-C-compliant compiler is allowed to generate code that does absolutely anything; which makes the worries over adding a warning kind of ridiculous.
- wtallis 6y agoI wonder if this might be a case where the assignment isn't undefined behavior, but an attempt to dereference the pointer and access the wrong struct type's members would be.
- fanf2 6y agoThe Bark Meow pointer conversion isn’t UB itself, provided you convert the pointer back to the correct type before dereferencing it.