In C ++ is there any sort of optimization or caching that prevents the same mathematical operation between constants from being repeated, especially in loops , thus decreasing application performance?
For example:
for (int i=0; i<=100; i++)
std::cout << i << " metros/s:" << " = " << i * (3600 / 1000) << " Km/h" << endl;
The above example is obviously fictional, but it is just to illustrate the situation. It could be a loop of millions of times with hundreds of calculations involving repeated constants.
Then I ask:
I understand that this question is pertinent, because it involves the programming style that should be adopted.