hello,
is there something like a debug/release mode in g++ like in ms visual studio 2003?
regards,
hello,
is there something like a debug/release mode in g++ like in ms visual studio 2003?
regards,
Historically, the microsoft debugger could not handle optimised code, so either you had a debug build (lots of debug, no optimisation), or release (no debug, optimised code). I don't know if the latest versions solve this problem.
The GNU tools allow the debugger to work with optimised code, although the results can look pretty odd if you're single-stepping through optimised code
Basically, all it means for you is that "release" adds "-O2" to the compiler command line. The 2 is the level of optimisation (there are several more as described in the manual).
There are also a huge number of long options to request specific optimisations to be carried out when you want more control than the summary options like -O2 provide.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
also, use -g to include debug info in your build. This will help when using tools like gdb.
And when I compile code with "g++ -O2" on my XEON machine, is it already optimized for the processor?
yes.
whenever you build with optimisations it is optimised for the processor.
Originally Posted by Jeff Henager
what about defining NDEBUG to disable assert and other debug macros?
any others define symbols to control debugging?