Re:Tell HN: C Experts Panel – Ask us anything about C
by flatfinger on Tuesday April 21, 2020 @01:41PM
(#22937286)
In many cases, the semantics programmers would require are much looser than anything provided for by the Standard. For example, if a programmer requires an expression that computes (x \* y / z) when there is no overflow, and computes an arbitrary value with no side effects when there is an overflow, a programmer could write the expression with unsigned and signed casting operators, but that would force a compiler generate machine code to actually perform the multiplication and division even in cases where it knows that y will always be twice z. Under "yield any value with no side effects" semantics, a compiler could replace the expression with (x \* 2), which would be much faster to compute.
[ Parent
| on HN ]
There are no comments on this comment yet.