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 >
GNU Info File  |  1994-07-11  |  43KB  |  803 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.55 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License" and "Protect
  13. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  14. original, and provided that the entire resulting derived work is
  15. distributed under the terms of a permission notice identical to this
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that the sections entitled "GNU General Public
  19. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  20. permission notice, may be included in translations approved by the Free
  21. Software Foundation instead of in the original English.
  22. File: gcc.info,  Node: Invoking G++,  Next: C Dialect Options,  Prev: Overall Options,  Up: Invoking GCC
  23. Compiling C++ Programs
  24. ======================
  25.    C++ source files conventionally use one of the suffixes `.C', `.cc',
  26. or `.cxx'; preprocessed C++ files use the suffix `.ii'.  GNU CC
  27. recognizes files with these names and compiles them as C++ programs
  28. even if you call the compiler the same way as for compiling C programs
  29. (usually with the name `gcc').
  30.    However, C++ programs often require class libraries as well as a
  31. compiler that understands the C++ language--and under some
  32. circumstances, you might want to compile programs from standard input,
  33. or otherwise without a suffix that flags them as C++ programs.  `g++'
  34. is a shell script that calls GNU CC with the default language set to
  35. C++, and automatically specifies linking against the GNU class library
  36. libg++.  (1) On many systems, the script `g++' is also installed with
  37. the name `c++'.
  38.    When you compile C++ programs, you may specify many of the same
  39. command-line options that you use for compiling programs in any
  40. language; or command-line options meaningful for C and related
  41. languages; or options that are meaningful only for C++ programs.  *Note
  42. Options Controlling C Dialect: C Dialect Options, for explanations of
  43. options for languages related to C.  *Note Options Controlling C++
  44. Dialect: C++ Dialect Options, for explanations of options that are
  45. meaningful only for C++ programs.
  46.    ---------- Footnotes ----------
  47.    (1)  Prior to release 2 of the compiler, there was a separate `g++'
  48. compiler.  That version was based on GNU CC, but not integrated with
  49. it.  Versions of `g++' with a `1.XX' version number--for example, `g++'
  50. version 1.37 or 1.42--are much less reliable than the versions
  51. integrated with GCC 2.  Moreover, combining G++ `1.XX' with a version 2
  52. GCC will simply not work.
  53. File: gcc.info,  Node: C Dialect Options,  Next: C++ Dialect Options,  Prev: Invoking G++,  Up: Invoking GCC
  54. Options Controlling C Dialect
  55. =============================
  56.    The following options control the dialect of C (or languages derived
  57. from C, such as C++ and Objective C) that the compiler accepts:
  58. `-ansi'
  59.      Support all ANSI standard C programs.
  60.      This turns off certain features of GNU C that are incompatible
  61.      with ANSI C, such as the `asm', `inline' and `typeof' keywords, and
  62.      predefined macros such as `unix' and `vax' that identify the type
  63.      of system you are using.  It also enables the undesirable and
  64.      rarely used ANSI trigraph feature, and disallows `$' as part of
  65.      identifiers.
  66.      The alternate keywords `__asm__', `__extension__', `__inline__'
  67.      and `__typeof__' continue to work despite `-ansi'.  You would not
  68.      want to use them in an ANSI C program, of course, but it useful to
  69.      put them in header files that might be included in compilations
  70.      done with `-ansi'.  Alternate predefined macros such as `__unix__'
  71.      and `__vax__' are also available, with or without `-ansi'.
  72.      The `-ansi' option does not cause non-ANSI programs to be rejected
  73.      gratuitously.  For that, `-pedantic' is required in addition to
  74.      `-ansi'.  *Note Warning Options::.
  75.      The macro `__STRICT_ANSI__' is predefined when the `-ansi' option
  76.      is used.  Some header files may notice this macro and refrain from
  77.      declaring certain functions or defining certain macros that the
  78.      ANSI standard doesn't call for; this is to avoid interfering with
  79.      any programs that might use these names for other things.
  80.      The functions `alloca', `abort', `exit', and `_exit' are not
  81.      builtin functions when `-ansi' is used.
  82. `-fno-asm'
  83.      Do not recognize `asm', `inline' or `typeof' as a keyword.  These
  84.      words may then be used as identifiers.  You can use the keywords
  85.      `__asm__', `__inline__' and `__typeof__' instead.  `-ansi' implies
  86.      `-fno-asm'.
  87. `-fno-builtin'
  88.      Don't recognize builtin functions that do not begin with two
  89.      leading underscores.  Currently, the functions affected include
  90.      `abort', `abs', `alloca', `cos', `exit', `fabs', `ffs', `labs',
  91.      `memcmp', `memcpy', `sin', `sqrt', `strcmp', `strcpy', and
  92.      `strlen'.
  93.      GCC normally generates special code to handle certain builtin
  94.      functions more efficiently; for instance, calls to `alloca' may
  95.      become single instructions that adjust the stack directly, and
  96.      calls to `memcpy' may become inline copy loops.  The resulting
  97.      code is often both smaller and faster, but since the function
  98.      calls no longer appear as such, you cannot set a breakpoint on
  99.      those calls, nor can you change the behavior of the functions by
  100.      linking with a different library.
  101.      The `-ansi' option prevents `alloca' and `ffs' from being builtin
  102.      functions, since these functions do not have an ANSI standard
  103.      meaning.
  104. `-trigraphs'
  105.      Support ANSI C trigraphs.  You don't want to know about this
  106.      brain-damage.  The `-ansi' option implies `-trigraphs'.
  107. `-traditional'
  108.      Attempt to support some aspects of traditional C compilers.
  109.      Specifically:
  110.         * All `extern' declarations take effect globally even if they
  111.           are written inside of a function definition.  This includes
  112.           implicit declarations of functions.
  113.         * The newer keywords `typeof', `inline', `signed', `const' and
  114.           `volatile' are not recognized.  (You can still use the
  115.           alternative keywords such as `__typeof__', `__inline__', and
  116.           so on.)
  117.         * Comparisons between pointers and integers are always allowed.
  118.         * Integer types `unsigned short' and `unsigned char' promote to
  119.           `unsigned int'.
  120.         * Out-of-range floating point literals are not an error.
  121.         * Certain constructs which ANSI regards as a single invalid
  122.           preprocessing number, such as `0xe-0xd', are treated as
  123.           expressions instead.
  124.         * String "constants" are not necessarily constant; they are
  125.           stored in writable space, and identical looking constants are
  126.           allocated separately.  (This is the same as the effect of
  127.           `-fwritable-strings'.)
  128.         * All automatic variables not declared `register' are preserved
  129.           by `longjmp'.  Ordinarily, GNU C follows ANSI C: automatic
  130.           variables not declared `volatile' may be clobbered.
  131.         * In the preprocessor, comments convert to nothing at all,
  132.           rather than to a space.  This allows traditional token
  133.           concatenation.
  134.         * In the preprocessor, macro arguments are recognized within
  135.           string constants in a macro definition (and their values are
  136.           stringified, though without additional quote marks, when they
  137.           appear in such a context).  The preprocessor always considers
  138.           a string constant to end at a newline.
  139.         * The predefined macro `__STDC__' is not defined when you us