Best command line options for debug/release builds

richardcavell@mail.com richardcavell@mail.com
Mon Mar 21 07:47:00 GMT 2011


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




More information about the Gcc-help mailing list