3 ms·
> Thus, Bosque does not have any undefined behavior I think this is the one that should be highlighted most. Otherwise, from an engineering perspective, many o
by mshockwave 8y ago
> Thus, Bosque does not have any undefined behavior
I think this is the one that should be highlighted most. Otherwise, from an engineering perspective, many of the other language features have already been implemented and widely used in other languages
- emmanueloga_ 8y agoI think I remember someone talk about undefined behavior in specifications and how it is actually a good thing, in the sense that offers increased liberty for implementations and some other advantages. Anybody else has heard this? Don't quite remember where I read it. My humble opinion aligns with yours, it seems intuitively "better" to have no undefined behavior. https://en.wikipedia.org/wiki/Undefined_behavior#Risks https://en.wikipedia.org/wiki/Undefined_behavior#Risks
- a1369209993 8y agoThat was the original rationale for introducing (formally) undefined behavior in the original C standard. Malicious optimization is a after-the-fact perversion of it.
- c256 8y agoEspecially in C-like languages, undefined behavior is one of the main things that creates space for compilers to get better (produce faster code, or produce code faster, or smaller, etc). That topic comes up in compiler discussions every so often; I would hazard a guess that one of those references is what you have in mind.
- dkersten 8y agoYes, I've heard the same thing. The C and C++ specifications specifically mention that some things are undefined behaivour, that shows that its not something that slipped through the cracks (at least in those cases) but rather a conscious decision to leave it undefined. This only makes sense if its done to allow the compiler room to do things like aggressive optimisation. I only wish that undefined behaviour in C++ were harder to accidentally use, or at least, if the compiler warned me "hey, I'm gonna do X here because that undefined behaviour here allows me to do so, this may not be portable to other compilers and may not be what you wanted, you've been warned!"
- readams 7y agoThe reason that these behaviors are undefined typically is that the compiler cannot prove whether or not a program will execute undefined behavior, and needing to account for it would lead to less efficient code. For example if (x+1 > x) can be simplified to if (true) for signed integers only because signed overflow is undefined. That said, there is UBSan, which is a runtime checker for undefined behavior that can help you to identify if your code is depending on some undefined result.
- Retra 8y agoUndefined behavior allows a compiler to make assumptions that some things never happen, which can allow them to generate more efficient code by not having to generate code that checks if those assumptions are correct. If you're going around thinking computing resources are cheap, it doesn't make much sense to avoid those correctness checks, and undefined behavior is probably not good from that perspective.
- samatman 8y agoI will always take an opportunity to link to Undefined Intimacy with the Machine[0]. Whether or not you agree with Evan Buswell, it is a solid argument, both for its thesis, and for the utility of Code Studies in general. 0: http://thoughtmesh.net/publish/367.php http://thoughtmesh.net/publish/367.php