After my post on undefined behavior in C some people insisted that it’s demonstrably fine, we know what the code will do, and at worst we’ll get a segfault.
I wouldn’t say “nobody ever”, but I would say it’s important to carefully consider whether it is really worthwhile using in any particular instance. It’s certainly safer, in the sense of reducing risk of UB, not to use it. In select cases, though, it might allow for significantly better optimisation of code.
I wouldn’t say “nobody ever”, but I would say it’s important to carefully consider whether it is really worthwhile using in any particular instance. It’s certainly safer, in the sense of reducing risk of UB, not to use it. In select cases, though, it might allow for significantly better optimisation of code.
score 1 · canonical
Or you could do what Zig ReleaseFast mode does and turn every single assert into
__builtin_assume.score 1 · canonical
Yeah that sounds like a terrible idea… it means adding assertions actually makes your program less safe to run in release mode. Amazing.
score 1 · canonical