3 ms·
"I'm simply not willing to pay the price to catch all potentially dangerous UB at build time. " Huh? The point is the opposite: that UB is apparently explici
by mpweiher 12y ago
"I'm simply not willing to pay the price to catch all potentially dangerous UB at build time. "
Huh? The point is the opposite: that UB is apparently explicitly (or maybe implicitly) recognized and exploited for non-sensical "optimizations". So it's not that the compiler should do extra work to catch dangerous UB. It's that it shouldn't do this extra work to then do unexpected stupid stuff. Either not doing the extra work at all or doing something sensible would be OK.
- MaulingMonkey 12y ago"that UB is apparently explicitly (or maybe implicitly) recognized" Potential UB is identified, but that's absolutely not the same as identifying certain or even likely UB. For the cases where it's certain or likely as determinable by the compiler: Yes, please turn these into errors and warnings. As I've said, "I would agree it should not be taken as "you should do anything"". But that's as little as I address certain UB, the majority of my post then talks about potential UB in general. I want the optimizer to have free reign to let "anything" happen, by ignoring scenarios which would cause UB, if those scenarios are sufficiently unlikely. Even if that means occasionally backfiring as "unexpected stupid stuff" when statistics catch up to me. I suspect I have a higher tolerance for weirdness in the name of performance than the topic article's author. The majority of my post (including what you quote) then centers on justifying this higher tolerance.