  TSI Gabe Premium,VIP join:2007-01-03 Chatham, ON | reply to Steve Re: For those wondering "Why Playstation 3s?"
That was the C compiler optimizing my code into doing nothing quite literally. Sometimes those C optimizations don't really help... |
|
  Steve I'm a PC, so shut up Consultant join:2001-03-10 Yorba Linda, CA
| said by TSI Gabe :That was the C compiler optimizing my code into doing nothing quite literally. Sometimes those C optimizations don't really help... It's far more likely that your optimizer found a bug in your code than you found a bug in the optimizer.
The problem with compilers is that they do exactly what you ask them too bad women and children won't follow that example 
Steve -- Stephen J. Friedl | Unix Wizard | Microsoft Security MVP | Orange County, California USA | my web site |
|
  TSI Gabe Premium,VIP join:2007-01-03 Chatham, ON | No Actually removing a printf simply displaying the value being calculated completely removed the md5 function from the code. |
|
  Steve I'm a PC, so shut up Consultant join:2001-03-10 Yorba Linda, CA
| said by TSI Gabe :No Actually removing a printf simply displaying the value being calculated completely removed the md5 function from the code. The compiler did what it was supposed to do: if you were calling a function that had no side effects, it knew that it could eliminate the call without having any effect on correct operation. It was right.
Benchmarking is a known science; calling your operation in a way that insists on a side effect (as I'm sure you found) lets you get the effect you want.
Steve -- Stephen J. Friedl | Unix Wizard | Microsoft Security MVP | Orange County, California USA | my web site |
|