This is my benchmark code sample :
Two ways of doing it :
volatile result = compute();
2nd way of doing it :
bool result = compute();
DoNotOptimize(result);
So i want to prevent the compiler to remove the compute() so which ones better ? Is it true that both have same effects ?