Re:Undefined behavior is often a thing for C programmers (2011)
by btrask on Thursday September 03, 2020 @03:01PM
(#24367491)
If you remove the standard, wouldn't everything naturally be implementation-defined? Like, say, Python.
[ Parent
| on HN ]
Re:Undefined behavior is often a thing for C programmers (2011)
by nwmcsween on Thursday September 03, 2020 @06:50PM
(#24369741)
Yep and you would end up with what was occuring before there a standard was created (POSIX, etc) which is generally a giant dumpster fire of implementation defined hell.
Re:Undefined behavior is often a thing for C programmers (2011)
by btrask on Thursday September 03, 2020 @10:18PM
(#24371118)
Have you thought about why having a standard causes all these problems with undefined behavior? The point of a standard is to be less specific than a reference implementation. That's why it's written in English, not code. That means definitions are fuzzy, which is why every kind of English-language law, rule, or spec is vulnerable to malicious compliance.
If C had a judge, like the legal system, he could deny attempts to use fuzziness in the standard (intended to prevent specifying bugs) to introduce bugs. Unfortunately, C doesn't have a judge with common sense, it has people who think the standard is code and anything that is undefined really is a license to do whatever you want.
I guess this problem was inevitable as soon as the words "nasal demons" were put to keyboard. Now the only thing that can save us is a reference implementation.