Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




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.

  Published under the terms of the GNU General Public License Design by Interspire