- publishing free software manuals
An Introduction to GCC - for the GNU compilers gcc and g++
by Brian J. Gough, foreword by Richard M. Stallman
Paperback (6"x9"), 144 pages
ISBN 0954161793
RRP £12.95 ($19.95)

"An excellent introduction... fills a much-needed niche in the marketplace" --- Association of C and C++ Users book review (Issue 16-4, August 2004) Get a printed copy>>>

6.6 Optimization and debugging

With GCC it is possible to use optimization in combination with the debugging option -g. Many other compilers do not allow this.

When using debugging and optimization together, the internal rearrangements carried out by the optimizer can make it difficult to see what is going on when examining an optimized program in the debugger. For example, temporary variables are often eliminated, and the ordering of statements may be changed.

However, when a program crashes unexpectedly, any debugging information is better than none--so the use of -g is recommended for optimized programs, both for development and deployment. The debugging option -g is enabled by default for releases of GNU packages, together with the optimization option -O2.

ISBN 0954161793An Introduction to GCC - for the GNU compilers gcc and g++See the print edition