⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 g++.1

📁 早期freebsd实现
💻 1
📖 第 1 页 / 共 2 页
字号:
.\" Copyright (c) 1991 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 "27dec1991" "GNU Tools" "GNU Tools".de BP.sp.ti \-.2i\(**...SH NAMEg++ \- GNU project C++ Compiler (v2 preliminary).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\&\|', or `\|\c.B .cxx\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.BI +e Ncontrol whether virtual function definitions in classesare used to generate code, or only to define interfaces for theircallers.  These options are provided for compatibility with cfront1.x usage; the recommended GNU C++ usage is to use .B #pragma interfaceand .B#pragma implementation\c\&, instead.With `\|\c.B +e0\c\&\|', virtual function definitions in classes are declared extern;the declaration is used only as an interface specification, not togenerate code for the virtual functions (in this compilation).With `\|\c.B +e1\c\&\|', .B g++actually generates the code implementing virtual functionsdefined in the code, and makes them publicly visible..TP.B \-fall\-virtualWhen you use the `\|\c.B \-fall\-virtual\c\&\|', all member functions(except for constructor functions and new/delete member operators)declared in the same class with a ``method-call'' operator method aretreated as virtual functions of the given class.  In effect, allof these methods become ``implicitly virtual.''This does \c.I not\c\& mean that all calls to these methods will be made through theinternal table of virtual functions.  There are some circumstancesunder which it is obvious that a call to a given virtual function canbe made directly, and in these cases the calls still go direct.The effect of making all methods of a class with a declared\&`\|\c.Boperator->()()\c\&\|' implicitly virtual using `\|\c.B \-fall\-virtual\c\&\|' extendsalso to all non-constructor methods of any class derived from such aclass..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 \-fgnu\-binutils.TP.B \-fno\-gnu\-binutils`\|\c.B \-fgnu\-binutils\&\|' (the default for most, but not all, platforms) makes GNU C++emit extra information for static initialization and finalization.This information has to be passed from the assembler to the GNUlinker.  Some assemblers won't pass this information; you must eitheruse GNU.B asor specify the option `\|\c.B \-fno\-gnu\-binutils\c\&\|'.With `\|\c.B \-fno\-gnu\-binutils\c\&\|', you must use the program.B collect(part of the GCC distribution) for linking..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\-inlineIf `\|\c.B \-fdefault\-inline\c\&\|' is enabled then member functions defined inside classscope are compiled inline by default; i.e., you don't need toadd `\|\c.B inline\c\&\|' in front of the member function name.  By populardemand, this option is now the default.  To keep GNU C++ from inliningthese member functions, specify `\|\c.B \-fno\-default\-inline\c\&\|'..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 \-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\&\|'..TP.B \-gProduce debugging information in the operating system's native format(for DBX or SDB or DWARF).  GDB also can work with this debugginginformation.  On most systems that use DBX format, `\|\c.B \-g\c\&\|' enables useof extra debugging information that only GDB can use.Unlike most other C compilers, GNU CC allows you to use `\|\c.B \-g\c\&\|' with`\|\c.B \-O\c\&\|'.  The shortcuts taken by optimized code may occasionallyproduce surprising results: some variables you declared may not existat all; flow of control may briefly move where you did not expect it;some statements may not be executed because they compute constantresults or their values were already at hand; some statements may

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -