Hey all,
I just noticed a missed performance opportunity:
#include <cmath> int main() { const double C[2] = { 1., 0. }; double v = C[1] * cos(.42 * argc); return v; }
This will call cos even though the result will always be 0. Now compare this to this code:
#include <cmath> int main() { double v = 0. * cos(.42 * argc); return v; }
Here, the call to cos is properly optimized away. This is what I'd expect from the first code as well.