logoalt Hacker News

fookeryesterday at 5:38 PM1 replyview on HN

This comes from a fundamental misunderstanding of what UB is.

Think of this piece of code - `y * x / y`.

Would you like to simplify it to just `x` ?

You need to either lean on UB to do so or have some magical way to prove that y can not be 0.

Otherwise this transformation changes behavior, and is illegal.


Replies

colejohnson66yesterday at 6:45 PM

Why not just execute what I wrote? Maybe I'm doing some rounding?

show 2 replies