4 ms·
The problem is cmp and cmp_once are actually different if x and y are function calls. In that case cmp calls the functions twice.
by CJefferson 9y ago
The problem is cmp and cmp_once are actually different if x and y are function calls. In that case cmp calls the functions twice.
- loeg 9y agoI think you've misread the question. Grandparent isn't asking why use cmp_once at all; they're asking, why not always force the single evaluation of x and y (i.e., always use cmp_once and let the compiler optimizer reduce the resulting expression)? A responsive answer is given in https://news.ycombinator.com/item?id=16720118 https://news.ycombinator.com/item?id=16720118 .