3 ms·
As a metapoint, the fact that there is this confusing epistemological minefield around the specified semantics is a bad thing in itself, separate from the evils
by fulafel 7y ago
As a metapoint, the fact that there is this confusing epistemological minefield around the specified semantics is a bad thing in itself, separate from the evils of UB.
- jacinabox 7y agoThe implementation of stdlib necessarily contains code which invokes implementation defined behavior, and the reason that the compiler implementation doesn't treat it in like manner is simply that it doesn't identify it as such or is prevented from doing so. So the treatment of libraries doesn't need to be consistent with that of user programs. Practices that ensure that such code is not optimized away include scattering the information needed to do so across multiple translation units, so that the compiler does not put them together.
- paulddraper 7y agoYou're not wrong but what are the alternatives? (1) Have a vague spec that doesn't distinguish between defined and undefined behavior. (2) Define everything, at the cost of performance/hardware support. Remember that C works on 50-year-old hardware, and current hardware.
- fulafel 7y ago(2) is the usual standard in computing. It's not like there aren't any performance or hw support compromises in current C.