This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Best command line options for debug/release builds
- From: richardcavell at mail dot com
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 21 Mar 2011 03:47:33 -0400
- Subject: Best command line options for debug/release builds
Hi everyone,
I have a project that is intended to be run with debugging turned on.
It's a Wikipedia bot, so performance is not a priority, while having
the code detect and report all possible errors without damaging
Wikipedia *is* a priority. I'm not running it within a debugger, but I
want the code to be internally safe (eg it pads string arrays with
extra chars just in case they get accidentally overwritten, it checks
for NULL before dereferencing a pointer, etc.)
Now, in order to get my code running as a 'release' build, I have
always thought that one selects either -O2 or -O3 and that's it, while
to run it as a debug build means simply to remove the -Ox option. But
there's more to a 'debug' build than that. What are your favourite
command line options to get a 'debug' build, or a 'release' build?
Richard