| ▲ | torstenvl 3 hours ago | |
UB doesn't mean there will be nasal demons. It means there can be nasal demons, if the implementation says so. It means the language standard does not define a behavior. POSIX can still define the behavior. The implementation can still define the behavior. Plenty of things are UB just because major implementations do things wildly differently. For example:
Having initialization be UB means that implementations where it's zero cost can initialize them to zero, or implementations designed for safety-critical systems can initialize them to zero, or what have you, without the standard forcing all implementations to do so. | ||
| ▲ | AlotOfReading 3 hours ago | parent | next [-] | |
All of that implementation freedom is also available if the behavior is erroneous instead. Having it defined as UB just gets you nasal demons, which incidentally this rule leads to on modern compilers. For example: | ||
| ▲ | forrestthewoods 40 minutes ago | parent | prev [-] | |
Yeah that’s just really bad language design. Which, again, literally no modern languages do because it’s just terrible horrible awful no good very bad design. | ||