-->

Previous | Table of Contents | Next

Page 156

Options must be separate: _dr is quite different from _d -r.

Most _f and _W options have two contrary forms: _fname and _fno_name (or _Wname and _Wno_name). Only the nondefault forms are shown here.

_c Compile or assemble the source files, but do not link. The compiler output is an object file corresponding to each source file.
_Dmacro Define macro macro with the string 1 as its definition.
_Dmacro=defn Define macro macro as defn.
_E Stop after the preprocessing stage; do not run the compiler proper. The output is preprocessed source code, which is sent to the standard output.
_fall_virtual Treat all possible member functions as virtual, implicitly. All member functions (except for constructor functions and new or delete member operators) are treated as virtual functions of the class where they appear.
This does not mean that all calls to these member functions will be made through the internal table of virtual functions. Under some circumstances, the compiler can determine that a call to a given virtual function can be made directly; in these cases the calls are direct in any case.
_fdollars_in_identifiers Permit the use of $ in identifiers. Traditional C allowed the character $ to form part of identifiers; by default, GNU C also allows this. However, ANSI C forbids $ in identifiers, and GNU C++ also forbids it by default on most platforms (though on some platforms it's enabled by default for GNU C++ as well).
_felide_constructors Use this option to instruct the compiler to be smarter about when it can elide constructors. Without this flag, GNU C++ and cfront both generate effectively the same code for

                                              A foo ();

                                              A x (foo ()); // x initialized by `foo ()', no ctor called

                                              A y = foo (); // call to `foo ()' heads to temporary, // y is

                                              initialized from the temporary.

Note the difference. With this flag, GNU C++ initializes y directly from the call to foo() without going through a temporary.
_fenum_int_equiv Normally GNU C++ allows conversion of enum to int, but not the other way around. Use this option if you want GNU C++ to allow conversion of int to enum as well.
_fexternal_templates Produce smaller code for template declarations, by generating only a single copy of each template function where it is defined. To use this option successfully, you must also mark all files that use templates with either #pragma implementation (the definition) or #pragma interface (declarations).
When your code is compiled with _fexternal_templates, all template instantiations are external. You must arrange for all necessary instantiations to appear in the implementation file; you can do this with a typedef that references each instantiation needed. Conversely, when you compile using the default option _fno_ external_templates, all template instantiations are explicitly internal.
_fno_gnu_linker Do not output global initializations (such as C++ constructors and destructors) in the form used by the GNU linker (on systems where the GNU linker is the standard method of handling them). Use this option when you want to use a non-GNU linker, which also requires using the collect2 program to make sure the system linker includes constructors and destructors. (collect2 is included in the GNU CC distribution.) For systems which must use collect2, the compiler driver gcc is configured to do this automatically.
_fmemoize_lookups_fsave_memorized These flags are used to get the compiler to compile programs faster using heuristics. They are not on by default since they are only effective about half the time. The other half of the time programs compile more slowly (and take more memory).

Page 157

The first time the compiler must build a call to a member function (or reference to a data member), it must (1) determine whether the class implements member functions of that name; (2) resolve which member function to call (which involves figuring out what sorts of type conversions need to be made); and (3) check the visibility of the member function to the caller. All of this adds up to slower compilation. Normally, the second time a call is made to that member function (or reference to that data member), it must go through the same lengthy process again. This means that code like this:

cout << "This " << p << "has"<< n << " legs.\n";

makes six passes through all three steps. By using a software cache, a "hit" significantly reduces this cost. Unfortunately, using the cache introduces another layer of mechanisms which must be implemented, and so incurs its own overhead. _fmemorize_ lookups enables the software cache.
Because access privileges (visibility) to members and member functions may differ from one function context to the next, g++ may need to flush the cache. With the _fmemoize_lookups flag, the cache is flushed after every function that is compiled. The _fsave_memorized flag enables the same software cache, but when the compiler determines that the context of the last function compiled would yield the same access privileges of the next function to compile, it preserves the cache. This is most helpful when defining many member functions for the same class: with the exception of member functions which are friends of other classes, each member function has exactly the same access privileges as every other, and the cache need not be flushed.
_fno_default_inline Do not make member functions inline by default merely because they are defined inside the class scope. Otherwise, when you specify _O, member functions defined inside class scope are compiled inline by default; that is, you don't need to add inline in front of the member function name.
_fno_strict_prototype Consider the declaration int foo;(). In C++, this means that the function foo takes no arguments. In ANSI C, this is declared int foo(void);. With the flag _fno_strict_prototype, declaring functions with no arguments is equivalent to declaring its argument list to be untyped, that is, int foo(); is equivalent to saying int foo (...);._fnonnull_objects. Normally, GNU C++ makes conservative assumptions about objects reached through references. For example, the compiler must check that a is not null in code like the following:

                                          obj &a = g ();

                                          a.f (2);

Checking that references of this sort have non-null values requires extra code, however, and it is unnecessary for many programs. You can use _fnonnull_objects to omit the checks for null, if your program doesn't require the default checking.
_fhandle_signatures_ These options control the recognition of the signature and sigof constructs for
fno_handle_signatures specifying abstract types. By default, these constructs are not recognized.
_fthis_is_variable The incorporation of user-defined free store management into C++ has made assignment to this an anachronism. Therefore, by default GNU C++ treats the type of this in a member function of class X to be X *const. In other words, it is illegal to assign to this within a class member function. However, for backwards compatibility, you can invoke the old behavior by using _fthis_is_variable.
_g Produce debugging information in the operating system's native format (for DBX or SDB or DWARF). GDB also can work with this debugging information. On most systems that use DBX format, _g enables use of extra debugging information that only GDB can use.
Unlike most other C compilers, GNU CC allows you to use _g with _0. The shortcuts taken by optimized code may occasionally produce surprising results: some

Previous | Table of Contents | Next