2 ms·
Compatibility is defined in terms of a contract between program and language implementation. If the program violates the contract by containing UB, then compati
by layer8 3y ago
Compatibility is defined in terms of a contract between program and language implementation. If the program violates the contract by containing UB, then compatibility does not apply.
Taking your argument, compilers couldn’t even add any benign optimization without breaking compatibility, because that would change the runtime of the affected code.
- agwa 3y ago> Compatibility is defined in terms of a contract between program and language implementation. If the program violates the contract by containing UB, then compatibility does not apply. Indeed, furthering my point that having UB in a language undermines backwards compatibility. > Taking your argument, compilers couldn’t even add any benign optimization without breaking compatibility, because that would change the runtime of the affected code. That does not follow from what I said.
- layer8 3y agoThe point is, you have to define compatibility with regards to what. Otherwise nothing can ever change. The purpose of the C standard is to provide that reference point, via its definition of what constitutes a conforming program and a conforming language implementation. You only get compatibility problems when you step out of that scope.