4 ms·
This test can not be optimized to always true: if (count > 0) total += unit_price(volume, count); Are you confusing it with the opposite scenario:
by throwawaylinux 5y ago
This test can not be optimized to always true:
if (count > 0)
total += unit_price(volume, count);
Are you confusing it with the opposite scenario:
total += unit_price(volume, count);
if (count == 0)
printf("oops\n");
That test might be optimized out because divide by zero is undefined behavior.
- colejohnson66 5y agoI probably am confusing them. I don’t program in C or C++, so I’m not aware of all the “gotchas”, and can easily confuse them (as shown here). Not to mention that compilers have been getting more aggressive in optimizing undefined behavior.