home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 5
/
FreshFish_July-August1994.bin
/
bbs
/
gnu
/
gcc-2.5.8-bin.lha
/
info
/
gcc.info-2
(
.txt
)
< prev
next >
Wrap
GNU Info File
|
1994-07-11
|
43KB
|
803 lines
This is Info file gcc.info, produced by Makeinfo-1.55 from the input
file gcc.texi.
This file documents the use and the internals of the GNU compiler.
Published by the Free Software Foundation 675 Massachusetts Avenue
Cambridge, MA 02139 USA
Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the sections entitled "GNU General Public License" and "Protect
Your Freedom--Fight `Look And Feel'" are included exactly as in the
original, and provided that the entire resulting derived work is
distributed under the terms of a permission notice identical to this
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the sections entitled "GNU General Public
License" and "Protect Your Freedom--Fight `Look And Feel'", and this
permission notice, may be included in translations approved by the Free
Software Foundation instead of in the original English.
File: gcc.info, Node: Invoking G++, Next: C Dialect Options, Prev: Overall Options, Up: Invoking GCC
Compiling C++ Programs
======================
C++ source files conventionally use one of the suffixes `.C', `.cc',
or `.cxx'; preprocessed C++ files use the suffix `.ii'. GNU CC
recognizes files with these names and compiles them as C++ programs
even if you call the compiler the same way as for compiling C programs
(usually with the name `gcc').
However, C++ programs often require class libraries as well as a
compiler that understands the C++ language--and under some
circumstances, you might want to compile programs from standard input,
or otherwise without a suffix that flags them as C++ programs. `g++'
is a shell script that calls GNU CC with the default language set to
C++, and automatically specifies linking against the GNU class library
libg++. (1) On many systems, the script `g++' is also installed with
the name `c++'.
When you compile C++ programs, you may specify many of the same
command-line options that you use for compiling programs in any
language; or command-line options meaningful for C and related
languages; or options that are meaningful only for C++ programs. *Note
Options Controlling C Dialect: C Dialect Options, for explanations of
options for languages related to C. *Note Options Controlling C++
Dialect: C++ Dialect Options, for explanations of options that are
meaningful only for C++ programs.
---------- Footnotes ----------
(1) Prior to release 2 of the compiler, there was a separate `g++'
compiler. That version was based on GNU CC, but not integrated with
it. Versions of `g++' with a `1.XX' version number--for example, `g++'
version 1.37 or 1.42--are much less reliable than the versions
integrated with GCC 2. Moreover, combining G++ `1.XX' with a version 2
GCC will simply not work.
File: gcc.info, Node: C Dialect Options, Next: C++ Dialect Options, Prev: Invoking G++, Up: Invoking GCC
Options Controlling C Dialect
=============================
The following options control the dialect of C (or languages derived
from C, such as C++ and Objective C) that the compiler accepts:
`-ansi'
Support all ANSI standard C programs.
This turns off certain features of GNU C that are incompatible
with ANSI C, such as the `asm', `inline' and `typeof' keywords, and
predefined macros such as `unix' and `vax' that identify the type
of system you are using. It also enables the undesirable and
rarely used ANSI trigraph feature, and disallows `$' as part of
identifiers.
The alternate keywords `__asm__', `__extension__', `__inline__'
and `__typeof__' continue to work despite `-ansi'. You would not
want to use them in an ANSI C program, of course, but it useful to
put them in header files that might be included in compilations
done with `-ansi'. Alternate predefined macros such as `__unix__'
and `__vax__' are also available, with or without `-ansi'.
The `-ansi' option does not cause non-ANSI programs to be rejected
gratuitously. For that, `-pedantic' is required in addition to
`-ansi'. *Note Warning Options::.
The macro `__STRICT_ANSI__' is predefined when the `-ansi' option
is used. Some header files may notice this macro and refrain from
declaring certain functions or defining certain macros that the
ANSI standard doesn't call for; this is to avoid interfering with
any programs that might use these names for other things.
The functions `alloca', `abort', `exit', and `_exit' are not
builtin functions when `-ansi' is used.
`-fno-asm'
Do not recognize `asm', `inline' or `typeof' as a keyword. These
words may then be used as identifiers. You can use the keywords
`__asm__', `__inline__' and `__typeof__' instead. `-ansi' implies
`-fno-asm'.
`-fno-builtin'
Don't recognize builtin functions that do not begin with two
leading underscores. Currently, the functions affected include
`abort', `abs', `alloca', `cos', `exit', `fabs', `ffs', `labs',
`memcmp', `memcpy', `sin', `sqrt', `strcmp', `strcpy', and
`strlen'.
GCC normally generates special code to handle certain builtin
functions more efficiently; for instance, calls to `alloca' may
become single instructions that adjust the stack directly, and
calls to `memcpy' may become inline copy loops. The resulting
code is often both smaller and faster, but since the function
calls no longer appear as such, you cannot set a breakpoint on
those calls, nor can you change the behavior of the functions by
linking with a different library.
The `-ansi' option prevents `alloca' and `ffs' from being builtin
functions, since these functions do not have an ANSI standard
meaning.
`-trigraphs'
Support ANSI C trigraphs. You don't want to know about this
brain-damage. The `-ansi' option implies `-trigraphs'.
`-traditional'
Attempt to support some aspects of traditional C compilers.
Specifically:
* All `extern' declarations take effect globally even if they
are written inside of a function definition. This includes
implicit declarations of functions.
* The newer keywords `typeof', `inline', `signed', `const' and
`volatile' are not recognized. (You can still use the
alternative keywords such as `__typeof__', `__inline__', and
so on.)
* Comparisons between pointers and integers are always allowed.
* Integer types `unsigned short' and `unsigned char' promote to
`unsigned int'.
* Out-of-range floating point literals are not an error.
* Certain constructs which ANSI regards as a single invalid
preprocessing number, such as `0xe-0xd', are treated as
expressions instead.
* String "constants" are not necessarily constant; they are
stored in writable space, and identical looking constants are
allocated separately. (This is the same as the effect of
`-fwritable-strings'.)
* All automatic variables not declared `register' are preserved
by `longjmp'. Ordinarily, GNU C follows ANSI C: automatic
variables not declared `volatile' may be clobbered.
* In the preprocessor, comments convert to nothing at all,
rather than to a space. This allows traditional token
concatenation.
* In the preprocessor, macro arguments are recognized within
string constants in a macro definition (and their values are
stringified, though without additional quote marks, when they
appear in such a context). The preprocessor always considers
a string constant to end at a newline.
* The predefined macro `__STDC__' is not defined when you us