?? g++.1
字號:
.\" Copyright (c) 1991, 1992 Free Software Foundation -*-Text-*-.\" See section COPYING for conditions for redistribution.\" FIXME: no info here on predefines. Should there be? extra for C++....TH G++ 1 "30apr1993" "GNU Tools" "GNU Tools".de BP.sp.ti \-.2i\(**...SH NAMEg++ \- GNU project C++ Compiler.SH SYNOPSIS.RB g++ " [" \c.IR option " | " filename " ].\|.\|..SH DESCRIPTIONThe C and C++ compilers are integrated;.B g++is a script to call.B gcc with options to recognize C++. .B gccprocesses input filesthrough one or more of four stages: preprocessing, compilation,assembly, and linking. This man page contains full descriptions for .I onlyC++ specific aspects of the compiler, though it also containssummaries of some general-purpose options. For a fuller explanationof the compiler, see.BR gcc ( 1 ).C++ source files use one of the suffixes `\|\c.B .C\c\&\|', `\|\c.B .cc\c\&\|', `\|\c.B .cxx\c\&\|', `\|\c.B .cpp\c\&\|', or `\|\c.B .c++\c\&\|'; preprocessed C++ files use the suffix `\|\c.B .ii\c\&\|'..SH OPTIONSThere are many command-line options, including options to controldetails of optimization, warnings, and code generation, which arecommon to both .B gccand.B g++\c\&. For full information on all options, see .BR gcc ( 1 ).Options must be separate: `\|\c.B \-dr\c\&\|' is quite different from `\|\c.B \-d \-r\&\|'. Most `\|\c.B \-f\c\&\|' and `\|\c.B \-W\c\&\|' options have two contrary forms: .BI \-f nameand.BI \-fno\- name\c\& (or .BI \-W nameand.BI \-Wno\- name\c\&). Only the non-default forms are shown here..TP.B \-cCompile or assemble the source files, but do not link. The compileroutput is an object file corresponding to each source file..TP.BI \-D macroDefine macro \c.I macro\c\& with the string `\|\c.B 1\c\&\|' as its definition..TP.BI \-D macro = defnDefine macro \c.I macro\c\& as \c.I defn\c\&..TP.B \-EStop after the preprocessing stage; do not run the compiler proper. Theoutput is preprocessed source code, which is sent to thestandard output..TP.B \-fall\-virtualTreat all possible member functions as virtual, implicitly. Allmember functions (except for constructor functions and.B newor.B deletemember operators) are treated as virtual functions of the class wherethey appear.This does not mean that all calls to these member functions will bemade through the internal table of virtual functions. Under somecircumstances, the compiler can determine that a call to a givenvirtual function can be made directly; in these cases the calls aredirect in any case..TP.B \-fdollars\-in\-identifiersPermit the use of `\|\c.B $\c\&\|' in identifiers.Traditional C allowed the character `\|\c.B $\c\&\|' to form part of identifiers; by default, GNU C alsoallows this. However, ANSI C forbids `\|\c.B $\c\&\|' in identifiers, and GNU C++ also forbids it by default on mostplatforms (though on some platforms it's enabled by default for GNUC++ as well)..TP.B \-felide\-constructorsUse this option to instruct the compiler to be smarter about when it canelide constructors. Without this flag, GNU C++ and cfront bothgenerate effectively the same code for:.sp.brA\ foo\ ();.brA\ x\ (foo\ ());\ \ \ //\ x\ initialized\ by\ `foo\ ()',\ no\ ctor\ called.brA\ y\ =\ foo\ ();\ \ \ //\ call\ to\ `foo\ ()'\ heads\ to\ temporary,.br\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ //\ y\ is\ initialized\ from\ the\ temporary..br.spNote the difference! With this flag, GNU C++ initializes `\|\c.B y\c\&\|' directlyfrom the call to .B foo ()without going through a temporary..TP.B \-fenum\-int\-equivNormally GNU C++ allows conversion of .B enumto.B int\c\&, but not the other way around. Use this option if you want GNU C++to allow conversion of.B intto .B enumas well. .TP.B \-fexternal\-templatesProduce smaller code for template declarations, by generating only asingle copy of each template function where it is defined.To use this option successfully, you must also mark all files thatuse templates with either `\|\c.B #pragma implementation\c\&\|' (the definition) or`\|\c.B #pragma interface\c\&\|' (declarations).When your code is compiled with `\|\c.B \-fexternal\-templates\c\&\|', alltemplate instantiations are external. You must arrange for allnecessary instantiations to appear in the implementation file; you cando this with a \c.B typedef\c\& that references each instantiation needed.Conversely, when you compile using the default option`\|\c.B \-fno\-external\-templates\c\&\|', all template instantiations areexplicitly internal..TP.B \-fno\-gnu\-linkerDo not output global initializations (such as C++ constructors anddestructors) in the form used by the GNU linker (on systems where the GNUlinker is the standard method of handling them). Use this option whenyou want to use a non-GNU linker, which also requires using the.B collect2program to make sure the system linker includesconstructors and destructors. (\c.B collect2is included in the GNU CC distribution.) For systems which.I mustuse.B collect2\c\&, the compiler driver.B gccis configured to do this automatically..TP.B \-fmemoize\-lookups.TP.B \-fsave\-memoizedThese flags are used to get the compiler to compile programs fasterusing heuristics. They are not on by default since they are only effectiveabout half the time. The other half of the time programs compile moreslowly (and take more memory).The first time the compiler must build a call to a member function (orreference to a data member), it must (1) determine whether the classimplements member functions of that name; (2) resolve which memberfunction to call (which involves figuring out what sorts of typeconversions need to be made); and (3) check the visibility of the memberfunction to the caller. All of this adds up to slower compilation.Normally, the second time a call is made to that member function (orreference to that data member), it must go through the same lengthyprocess again. This means that code like this.sp.br\ \ cout\ <<\ "This\ "\ <<\ p\ <<\ "\ has\ "\ <<\ n\ <<\ "\ legs.\en";.br.spmakes six passes through all three steps. By using a software cache,a ``hit'' significantly reduces this cost. Unfortunately, using thecache introduces another layer of mechanisms which must be implemented,and so incurs its own overhead. `\|\c.B \-fmemoize\-lookups\c\&\|' enablesthe software cache.Because access privileges (visibility) to members and member functionsmay differ from one function context to the next, .B g++may need to flush the cache. With the `\|\c.B \-fmemoize\-lookups\c\&\|' flag, the cache is flushed after everyfunction that is compiled. The `\|\c\-fsave\-memoized\c\&\|' flag enables the same software cache, but when the compilerdetermines that the context of the last function compiled would yieldthe same access privileges of the next function to compile, itpreserves the cache. This is most helpful when defining many member functions for the sameclass: with the exception of member functions which are friends ofother classes, each member function has exactly the same accessprivileges as every other, and the cache need not be flushed..TP.B \-fno\-default\-inlineDo not make member functions inline by default merely because they aredefined inside the class scope. Otherwise, when you specify.B \-O\c\&, member functions defined inside class scope are compiledinline by default; i.e., you don't need to add `\|\c.B inline\c\&\|' in front ofthe member function name..TP.B \-fno\-strict\-prototypeConsider the declaration \c.B int foo ();\c\&. In C++, this means that thefunction \c.B foo\c\& takes no arguments. In ANSI C, this is declared.B int foo(void);\c\&. With the flag `\|\c.B \-fno\-strict\-prototype\c\&\|',declaring functions with no arguments is equivalent to declaring itsargument list to be untyped, i.e., \c.B int foo ();\c\& is equivalent tosaying \c.B int foo (...);\c\&..TP.B \-fnonnull\-objectsNormally, GNU C++ makes conservative assumptions about objects reachedthrough references. For example, the compiler must check that `\|\c.B a\c\&\|' is not null in code like the following:.br\ \ \ \ obj\ &a\ =\ g\ ();.br\ \ \ \ a.f\ (2);.brChecking that references of this sort have non-null values requiresextra code, however, and it is unnecessary for many programs. You canuse `\|\c.B \-fnonnull\-objects\c\&\|' to omit the checks for null, if your program doesn't require thedefault checking..TP.B \-fhandle\-signatures.TP.B \-fno\-handle\-signaturesThese options control the recognition of the \c.B signature\c\& and \c.B sigof\c\& constructs for specifying abstract types. By default, theseconstructs are not recognized..TP.B \-fthis\-is\-variableThe incorporation of user-defined free store management into C++ hasmade assignment to \c.B this\c\& an anachronism. Therefore, by default GNUC++ treats the type of \c.B this\c\& in a member function of \c.B class X\c\&to be \c.B X *const\c\&. In other words, it is illegal to assign to\c.B this\c\& within a class member function. However, for backwardscompatibility, you can invoke the old behavior by using\&`\|\c.B \-fthis\-is\-variable\c
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -