Summary
This outlines some rationale and strategies for coping with the debug-vs-release
problems that sometimes come up. The simplest one is often the best: just turn
off all the optimizations in the release version. Then selectively turn on optimizations
for that 1% of your code that might matter. Assuming there is that much of your
code that matters. For a lot of the applications we write, so little code matters
that you get virtually the same performance for optimized and unoptimized code.
Other References
Check out http://www.cygnus-software.com/papers/release_debugging.html
for some additional useful insights by Bruce Dawson. A particularly nice point
he makes here is that you should always generate debug symbol information
with your release version, so you can actually debug problems in the product.
I don't know why I never thought of this, but I didn't!