Hacker News new | ask | show | jobs
by d110af5ccf 1858 days ago
How is the compiler supposed to know that a particular operation is intended as an overflow check though? It isn't a human and it doesn't actually comprehend the code it operates on. It just blindly applies rules.

I want the compiler to eliminate redundant operations. That's a large part of the point of doing optimizations in my view! Best effort attempts to avoid eliminating obvious sanity checks are desired of course, but I doubt it's feasible to reliably identify those short of AGI. (And at that point, why are you still writing code?)

1 comments

You are advocating incorrect code that uses a few less machine operations than correct code.
The compiler should have valid rules, not invalid ones.