Hacker News new | past | comments | ask | show | jobs | submit login

That's because UB has a well-defined meaning in the C programming language specification, for over 35 years now. And C has been one of the most widespread programming languages in use over that time.

One of the important things about UB and C is that C is a language defined by a standard, not any one compiler - and there are a lot of compilers. If a C compiler does something weird with your source code, we can say whether the compiler is correct or not, or whether your code is at fault. For many languages, that is not the case, and "whatever the compiler does to your code" is de facto correct, and "whatever the compiled version of your code happens to do on any given platform" is well-defined, even if it wasn't what you meant.

I'd argue that if a compiled language does not define what it means by UB, it doesn't have "UB".

But also, if a person talks about "UB", it is reasonable for a listener to assume they are by default talking about the well-defined term in the C programming language standard - unless they specify otherwise. Because that's the most enduring definition of the term we have.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: