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

>The problem they're trying to address is that C compliers take advantage of undefined behavior for optimizations

That's not a problem. That's a good thing.

>Such optimizations can cause very strange, unintuitive behavior that is very difficult to discover

That's a problem -- or at least the "difficult to discover" part is. "Strange" and "unintuitive" is helpful; it's a nice, big red flag. How does migrating from undefined behaviour to producing unspecified values make bugs easier to discover? I can see how they would make results more consistent, and the bugs easier to hunt down, but that's only useful once you know the bugs are there (inconsistency is another useful red flag here), and there are already good tools like valgrind and ubsan for tracking down the source of the bug.

>The goal of this proposal is to make them wrong in reasonable ways

That isn't the purview of C, though. It's a noble goal, don't get me wrong, but stepping on the optimizer's toes and reinforcing plainly bad programming practices -- I know that's not an intended effect, but it will happen -- isn't the way to do it. A better way, just as an example, would be to give the programmer a proper mechanism for encoding preconditions and other interprocedure-analysable constraints. This doesn't reinforce bad practices, it could actually help the optimizer if done right, and would perhaps encourage programmers to reason a little more rigorously about their code -- an ounce of prevention and all that.




Please read the linked posts and papers for answers to your questions.




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

Search: