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
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

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

  




 

 

7.2 C++ compilation options

Most GCC options can be used for both C and C++ programs, but there are also a few options which are specific to each language. This section describes some of the additional options, and enhancements to existing options, that are available in g++.

-Wall and -W
When compiling with g++, the options -Wall and -W include extra warnings specific to C++ (the warnings relate to member functions and virtual classes). The use of these options is always recommended while developing a program.
-fno-default-inline
This option disables the default inlining of member functions defined in the bodies of C++ classes. GCC normally inlines all such functions when optimization is turned on, even if they do not explicitly use the inline keyword. Select this option if you prefer to control inlining yourself, or want to set a breakpoint on member functions that would otherwise be inlined (since it is not possible to set a breakpoint on an inlined function).
-Weffc++
This option warns about C++ code which breaks some of the programming guidelines given in the books "Effective C++" and "More Effective C++" by Scott Meyers. For example, a warning will be given if a class which uses dynamically allocated memory does not define a copy constructor and an assignment operator. Note that the standard library header files do not follow these guidelines, so you may wish to use this option as an occasional test for possible problems in your own code rather than compiling with it all the time.
-Wold-style-cast
This option highlights any uses of C-style casts in C++ programs. The C++ language provides the keywords static_cast, dynamic_cast, reinterpret_cast and const_cast for handling casts and these are often preferable (although C-style casts are still allowed).

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