Turn off optimization when debugging

This tip submitted by Ashok Kumar on 2005-03-09 00:45:58. It has been viewed 42787 times.
Rating of 5.6 with 195 votes

This is an addendum to the tip titled "Turn on all compiler warnings" that occured on this list some time ago.

Turn off all optimization using -O0 when compiling with gcc or g++. This will help in doing away with any errors that code optimization might introduce.

More tips

Help your fellow programmers! Add a tip!