Tag: assumption
-
What happens when an assumption, i.e. [[assume]] contains UB?
6 In C++23, the [[assume(expression)]] attribute makes it so that if expression is false, the behavior is undefined. For example: int div(int x, int y) { [[assume(y == 1)]]; return x / y; } This compiles to the same code as if y was always 1. div(int, int): mov eax, edi ret However, what happens…