4 ms·
> This kind of implementation is actually quite concerning, because it means you're punting through a language which is notorious for its heavy reliance on unde
by DSMan195276 6y ago
> This kind of implementation is actually quite concerning, because it means you're punting through a language which is notorious for its heavy reliance on undefined behavior, and there is no way to opt out of undefined behavior in some cases.
I think it's worth pointing out that you can't always get away from those undefined behavior situations even if you skip C all together. Rust, for instance, has some internal/implementation details I've run across that are just C undefined behavior details leaking out of the LLVM IR instructions they use to implement the language, since those instructions have the same undefined behavior semantics as the corresponding C code they're used for.
- nicoburns 6y agoNot always, but a lot of the time. There are also a whole bootload of things that are UB in C but have defined semantics in Rust.
- DSMan195276 6y agoSure, I was mostly responding to the "compiles to C vs. directly to GCC/LLVM". I don't think the difference is actually all that relevant in terms of avoiding undefined behavior, a lot of the undefined behavior situations still need to either be worked around (or accepted) when generating the IR - it's not as simple as "skip C, UB is gone".