home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 6 / FreshFish_September1994.bin / bbs / gnu / gcc-2.6.0-src.lha / GNU / src / amiga / gcc-2.6.0 / gcc.info-8 < prev    next >
Encoding:
GNU Info File  |  1994-07-15  |  50.0 KB  |  1,221 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.  
  4.    This file documents the use and the internals of the GNU compiler.
  5.  
  6.    Published by the Free Software Foundation 675 Massachusetts Avenue
  7. Cambridge, MA 02139 USA
  8.  
  9.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  10.  
  11.    Permission is granted to make and distribute verbatim copies of this
  12. manual provided the copyright notice and this permission notice are
  13. preserved on all copies.
  14.  
  15.    Permission is granted to copy and distribute modified versions of
  16. this manual under the conditions for verbatim copying, provided also
  17. that the sections entitled "GNU General Public License" and "Protect
  18. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  19. original, and provided that the entire resulting derived work is
  20. distributed under the terms of a permission notice identical to this
  21. one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that the sections entitled "GNU General Public
  26. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  27. permission notice, may be included in translations approved by the Free
  28. Software Foundation instead of in the original English.
  29.  
  30. 
  31. File: gcc.info,  Node: Case Ranges,  Next: Function Attributes,  Prev: Cast to Union,  Up: C Extensions
  32.  
  33. Case Ranges
  34. ===========
  35.  
  36.    You can specify a range of consecutive values in a single `case'
  37. label, like this:
  38.  
  39.      case LOW ... HIGH:
  40.  
  41. This has the same effect as the proper number of individual `case'
  42. labels, one for each integer value from LOW to HIGH, inclusive.
  43.  
  44.    This feature is especially useful for ranges of ASCII character
  45. codes:
  46.  
  47.      case 'A' ... 'Z':
  48.  
  49.    *Be careful:* Write spaces around the `...', for otherwise it may be
  50. parsed wrong when you use it with integer values.  For example, write
  51. this:
  52.  
  53.      case 1 ... 5:
  54.  
  55. rather than this:
  56.  
  57.      case 1...5:
  58.  
  59. 
  60. File: gcc.info,  Node: Cast to Union,  Next: Case Ranges,  Prev: Labeled Elements,  Up: C Extensions
  61.  
  62. Cast to a Union Type
  63. ====================
  64.  
  65.    A cast to union type is similar to other casts, except that the type
  66. specified is a union type.  You can specify the type either with `union
  67. TAG' or with a typedef name.  A cast to union is actually a constructor
  68. though, not a cast, and hence does not yield an lvalue like normal
  69. casts.  (*Note Constructors::.)
  70.  
  71.    The types that may be cast to the union type are those of the members
  72. of the union.  Thus, given the following union and variables:
  73.  
  74.      union foo { int i; double d; };
  75.      int x;
  76.      double y;
  77.  
  78. both `x' and `y' can be cast to type `union' foo.
  79.  
  80.    Using the cast as the right-hand side of an assignment to a variable
  81. of union type is equivalent to storing in a member of the union:
  82.  
  83.      union foo u;
  84.      ...
  85.      u = (union foo) x  ==  u.i = x
  86.      u = (union foo) y  ==  u.d = y
  87.  
  88.    You can also use the union cast as a function argument:
  89.  
  90.      void hack (union foo);
  91.      ...
  92.      hack ((union foo) x);
  93.  
  94. 
  95. File: gcc.info,  Node: Function Attributes,  Next: Function Prototypes,  Prev: Case Ranges,  Up: C Extensions
  96.  
  97. Declaring Attributes of Functions
  98. =================================
  99.  
  100.    In GNU C, you declare certain things about functions called in your
  101. program which help the compiler optimize function calls and check your
  102. code more carefully.
  103.  
  104.    The keyword `__attribute__' allows you to specify special attributes
  105. when making a declaration.  This keyword is followed by an attribute
  106. specification inside double parentheses.  Four attributes, `noreturn',
  107. `const', `format', and `section' are currently defined for functions.
  108. Other attributes, including `section' are supported for variables
  109. declarations (*note Variable Attributes::.).
  110.  
  111. `noreturn'
  112.      A few standard library functions, such as `abort' and `exit',
  113.      cannot return.  GNU CC knows this automatically.  Some programs
  114.      define their own functions that never return.  You can declare them
  115.      `noreturn' to tell the compiler this fact.  For example,
  116.  
  117.           void fatal () __attribute__ ((noreturn));
  118.           
  119.           void
  120.           fatal (...)
  121.           {
  122.             ... /* Print error message. */ ...
  123.             exit (1);
  124.           }
  125.  
  126.      The `noreturn' keyword tells the compiler to assume that `fatal'
  127.      cannot return.  It can then optimize without regard to what would
  128.      happen if `fatal' ever did return.  This makes slightly better
  129.      code.  More importantly, it helps avoid spurious warnings of
  130.      uninitialized variables.
  131.  
  132.      Do not assume that registers saved by the calling function are
  133.      restored before calling the `noreturn' function.
  134.  
  135.      It does not make sense for a `noreturn' function to have a return
  136.      type other than `void'.
  137.  
  138.      The attribute `noreturn' is not implemented in GNU C versions
  139.      earlier than 2.5.  An alternative way to declare that a function
  140.      does not return, which works in the current version and in some
  141.      older versions, is as follows:
  142.  
  143.           typedef void voidfn ();
  144.           
  145.           volatile voidfn fatal;
  146.  
  147. `const'
  148.      Many functions do not examine any values except their arguments,
  149.      and have no effects except the return value.  Such a function can
  150.      be subject to common subexpression elimination and loop
  151.      optimization just as an arithmetic operator would be.  These
  152.      functions should be declared with the attribute `const'.  For
  153.      example,
  154.  
  155.           int square (int) __attribute__ ((const));
  156.  
  157.      says that the hypothetical function `square' is safe to call fewer
  158.      times than the program says.
  159.  
  160.      The attribute `const' is not implemented in GNU C versions earlier
  161.      than 2.5.  An alternative way to declare that a function has no
  162.      side effects, which works in the current version and in some older
  163.      versions, is as follows:
  164.  
  165.           typedef int intfn ();
  166.           
  167.           extern const intfn square;
  168.  
  169.      Note that a function that has pointer arguments and examines the
  170.      data pointed to must *not* be declared `const'.  Likewise, a
  171.      function that calls a non-`const' function usually must not be
  172.      `const'.  It does not make sense for a `const' function to return
  173.      `void'.
  174.  
  175. `format (ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)'
  176.      The `format' attribute specifies that a function takes `printf' or
  177.      `scanf' style arguments which should be type-checked against a
  178.      format string.  For example, the declaration:
  179.  
  180.           extern int
  181.           my_printf (void *my_object, const char *my_format, ...)
  182.                 __attribute__ ((format (printf, 2, 3)));
  183.  
  184.      causes the compiler to check the arguments in calls to `my_printf'
  185.      for consistency with the `printf' style format string argument
  186.      `my_format'.
  187.  
  188.      The parameter ARCHETYPE determines how the format string is
  189.      interpreted, and should be either `printf' or `scanf'.  The
  190.      parameter STRING-INDEX specifies which argument is the format
  191.      string argument (starting from 1), while FIRST-TO-CHECK is the
  192.      number of the first argument to check against the format string.
  193.      For functions where the arguments are not available to be checked
  194.      (such as `vprintf'), specify the third parameter as zero.  In this
  195.      case the compiler only checks the format string for consistency.
  196.  
  197.      In the example above, the format string (`my_format') is the second
  198.      argument of the function `my_print', and the arguments to check
  199.      start with the third argument, so the correct parameters for the
  200.      format attribute are 2 and 3.
  201.  
  202.      The `format' attribute allows you to identify your own functions
  203.      which take format strings as arguments, so that GNU CC can check
  204.      the calls to these functions for errors.  The compiler always
  205.      checks formats for the ANSI library functions `printf', `fprintf',
  206.      `sprintf', `scanf', `fscanf', `sscanf', `vprintf', `vfprintf' and
  207.      `vsprintf' whenever such warnings are requested (using
  208.      `-Wformat'), so there is no need to modify the header file
  209.      `stdio.h'.
  210.  
  211. `section ("section-name")'
  212.      Normally, the compiler places the code it generates in the `text'
  213.      section.  Sometimes, however, you need additional sections, or you
  214.      need certain particular functions to appear in special sections.
  215.      The `section' attribute specifies that a function lives in a
  216.      particular section.  For example, the declaration:
  217.  
  218.           extern void foobar (void) __attribute__ ((section (".init")));
  219.  
  220.      puts the function `foobar' in the `.init' section.
  221.  
  222.      Some file formats do not support arbitrary sections so the
  223.      `section' attribute is not available on all platforms.  If you
  224.      need to map the entire contents of a module to a particular
  225.      section, consider using the facilities of the linker instead.
  226.  
  227.    You can specify multiple attributes in a declaration by separating
  228. them by commas within the double parentheses or by immediately
  229. following an attribute declaration with another attribute declaration.
  230.  
  231.    Some people object to the `__attribute__' feature, suggesting that
  232. ANSI C's `#pragma' should be used instead.  There are two reasons for
  233. not doing this.
  234.  
  235.   1. It is impossible to generate `#pragma' commands from a macro.
  236.  
  237.   2. There is no telling what the same `#pragma' might mean in another
  238.      compiler.
  239.  
  240.    These two reasons apply to almost any application that might be
  241. proposed for `#pragma'.  It is basically a mistake to use `#pragma' for
  242. *anything*.
  243.  
  244. 
  245. File: gcc.info,  Node: Function Prototypes,  Next: Dollar Signs,  Prev: Function Attributes,  Up: C Extensions
  246.  
  247. Prototypes and Old-Style Function Definitions
  248. =============================================
  249.  
  250.    GNU C extends ANSI C to allow a function prototype to override a
  251. later old-style non-prototype definition.  Consider the following
  252. example:
  253.  
  254.      /* Use prototypes unless the compiler is old-fashioned.  */
  255.      #if __STDC__
  256.      #define P(x) x
  257.      #else
  258.      #define P(x) ()
  259.      #endif
  260.      
  261.      /* Prototype function declaration.  */
  262.      int isroot P((uid_t));
  263.      
  264.      /* Old-style function definition.  */
  265.      int
  266.      isroot (x)   /* ??? lossage here ??? */
  267.           uid_t x;
  268.      {
  269.        return x == 0;
  270.      }
  271.  
  272.    Suppose the type `uid_t' happens to be `short'.  ANSI C does not
  273. allow this example, because subword arguments in old-style
  274. non-prototype definitions are promoted.  Therefore in this example the
  275. function definition's argument is really an `int', which does not match
  276. the prototype argument type of `short'.
  277.  
  278.    This restriction of ANSI C makes it hard to write code that is
  279. portable to traditional C compilers, because the programmer does not
  280. know whether the `uid_t' type is `short', `int', or `long'.  Therefore,
  281. in cases like these GNU C allows a prototype to override a later
  282. old-style definition.  More precisely, in GNU C, a function prototype
  283. argument type overrides the argument type specified by a later
  284. old-style definition if the former type is the same as the latter type
  285. before promotion.  Thus in GNU C the above example is equivalent to the
  286. following:
  287.  
  288.      int isroot (uid_t);
  289.      
  290.      int
  291.      isroot (uid_t x)
  292.      {
  293.        return x == 0;
  294.      }
  295.  
  296. 
  297. File: gcc.info,  Node: Dollar Signs,  Next: Character Escapes,  Prev: Function Prototypes,  Up: C Extensions
  298.  
  299. Dollar Signs in Identifier Names
  300. ================================
  301.  
  302.    In GNU C, you may use dollar signs in identifier names.  This is
  303. because many traditional C implementations allow such identifiers.
  304.  
  305.    On some machines, dollar signs are allowed in identifiers if you
  306. specify `-traditional'.  On a few systems they are allowed by default,
  307. even if you do not use `-traditional'.  But they are never allowed if
  308. you specify `-ansi'.
  309.  
  310.    There are certain ANSI C programs (obscure, to be sure) that would
  311. compile incorrectly if dollar signs were permitted in identifiers.  For
  312. example:
  313.  
  314.      #define foo(a) #a
  315.      #define lose(b) foo (b)
  316.      #define test$
  317.      lose (test)
  318.  
  319. 
  320. File: gcc.info,  Node: Character Escapes,  Next: Variable Attributes,  Prev: Dollar Signs,  Up: C Extensions
  321.  
  322. The Character ESC in Constants
  323. ==============================
  324.  
  325.    You can use the sequence `\e' in a string or character constant to
  326. stand for the ASCII character ESC.
  327.  
  328. 
  329. File: gcc.info,  Node: Alignment,  Next: Inline,  Prev: Variable Attributes,  Up: C Extensions
  330.  
  331. Inquiring on Alignment of Types or Variables
  332. ============================================
  333.  
  334.    The keyword `__alignof__' allows you to inquire about how an object
  335. is aligned, or the minimum alignment usually required by a type.  Its
  336. syntax is just like `sizeof'.
  337.  
  338.    For example, if the target machine requires a `double' value to be
  339. aligned on an 8-byte boundary, then `__alignof__ (double)' is 8.  This
  340. is true on many RISC machines.  On more traditional machine designs,
  341. `__alignof__ (double)' is 4 or even 2.
  342.  
  343.    Some machines never actually require alignment; they allow reference
  344. to any data type even at an odd addresses.  For these machines,
  345. `__alignof__' reports the *recommended* alignment of a type.
  346.  
  347.    When the operand of `__alignof__' is an lvalue rather than a type,
  348. the value is the largest alignment that the lvalue is known to have.
  349. It may have this alignment as a result of its data type, or because it
  350. is part of a structure and inherits alignment from that structure.  For
  351. example, after this declaration:
  352.  
  353.      struct foo { int x; char y; } foo1;
  354.  
  355. the value of `__alignof__ (foo1.y)' is probably 2 or 4, the same as
  356. `__alignof__ (int)', even though the data type of `foo1.y' does not
  357. itself demand any alignment.
  358.  
  359.    A related feature which lets you specify the alignment of an object
  360. is `__attribute__ ((aligned (ALIGNMENT)))'; see the following section.
  361.  
  362. 
  363. File: gcc.info,  Node: Variable Attributes,  Next: Alignment,  Prev: Character Escapes,  Up: C Extensions
  364.  
  365. Specifying Attributes of Variables
  366. ==================================
  367.  
  368.    The keyword `__attribute__' allows you to specify special attributes
  369. of variables or structure fields.  This keyword is followed by an
  370. attribute specification inside double parentheses.  Four attributes are
  371. currently defined for variables: `aligned', `mode', `packed', and
  372. `section'.  Other attributes are defined for functions, and thus not
  373. documented here; see *Note Function Attributes::.
  374.  
  375. `aligned (ALIGNMENT)'
  376.      This attribute specifies a minimum alignment for the variable or
  377.      structure field, measured in bytes.  For example, the declaration:
  378.  
  379.           int x __attribute__ ((aligned (16))) = 0;
  380.  
  381.      causes the compiler to allocate the global variable `x' on a
  382.      16-byte boundary.  On a 68040, this could be used in conjunction
  383.      with an `asm' expression to access the `move16' instruction which
  384.      requires 16-byte aligned operands.
  385.  
  386.      You can also specify the alignment of structure fields.  For
  387.      example, to create a double-word aligned `int' pair, you could
  388.      write:
  389.  
  390.           struct foo { int x[2] __attribute__ ((aligned (8))); };
  391.  
  392.      This is an alternative to creating a union with a `double' member
  393.      that forces the union to be double-word aligned.
  394.  
  395.      It is not possible to specify the alignment of functions; the
  396.      alignment of functions is determined by the machine's requirements
  397.      and cannot be changed.  You cannot specify alignment for a typedef
  398.      name because such a name is just an alias, not a distinct type.
  399.  
  400.      The `aligned' attribute can only increase the alignment; but you
  401.      can decrease it by specifying `packed' as well.  See below.
  402.  
  403.      The linker of your operating system imposes a maximum alignment.
  404.      If the linker aligns each object file on a four byte boundary,
  405.      then it is beyond the compiler's power to cause anything to be
  406.      aligned to a larger boundary than that.  For example, if  the
  407.      linker happens to put this object file at address 136 (eight more
  408.      than a multiple of 64), then the compiler cannot guarantee an
  409.      alignment of more than 8 just by aligning variables in the object
  410.      file.
  411.  
  412. `mode (MODE)'
  413.      This attribute specifies the data type for the
  414.      declaration--whichever type corresponds to the mode MODE.  This in
  415.      effect lets you request an integer or floating point type
  416.      according to its width.
  417.  
  418. `packed'
  419.      The `packed' attribute specifies that a variable or structure field
  420.      should have the smallest possible alignment--one byte for a
  421.      variable, and one bit for a field, unless you specify a larger
  422.      value with the `aligned' attribute.
  423.  
  424.      Here is a structure in which the field `x' is packed, so that it
  425.      immediately follows `a':
  426.  
  427.           struct foo
  428.           {
  429.             char a;
  430.             int x[2] __attribute__ ((packed));
  431.           };
  432.  
  433. `section ("section-name")'
  434.      Normally, the compiler places the objects it generates in sections
  435.      like `data' and `bss'.  Sometimes, however, you need additional
  436.      sections, or you need certain particular variables to appear in
  437.      special sections, for example to map to special hardware.  The
  438.      `section' attribute specifies that a variable (or function) lives
  439.      in a particular section.  For example, this small program uses
  440.      several specific section names:
  441.  
  442.           struct duart a __attribute__ ((section ("DUART_A"))) = { 0 };
  443.           struct duart b __attribute__ ((section ("DUART_B"))) = { 0 };
  444.           char stack[10000] __attribute__ ((section ("STACK"))) = { 0 };
  445.           int init_data_copy __attribute__ ((section ("INITDATACOPY"))) = 0;
  446.           
  447.           main()
  448.           {
  449.             /* Initialize stack pointer */
  450.             init_sp (stack + sizeof (stack));
  451.           
  452.             /* Initialize initialized data */
  453.             memcpy (&init_data_copy, &data, &edata - &data);
  454.           
  455.             /* Turn on the serial ports */
  456.             init_duart (&a);
  457.             init_duart (&b);
  458.           }
  459.  
  460.      Use the `section' attribute with an *initialized* definition of a
  461.      *global* variable, as shown in the example.  GNU CC issues a
  462.      warning and otherwise ignores the `section' attribute in
  463.      uninitialized variable declarations.
  464.  
  465.      You may only use the `section' attribute with a fully initialized
  466.      global definition because of the way linkers work.  The linker
  467.      requires each object be defined once, with the exception that
  468.      uninitialized variables tentatively go in the `common' (or `bss')
  469.      section and can be multiply "defined".
  470.  
  471.      Some file formats do not support arbitrary sections so the
  472.      `section' attribute is not available on all platforms.  If you
  473.      need to map the entire contents of a module to a particular
  474.      section, consider using the facilities of the linker instead.
  475.  
  476.    To specify multiple attributes, separate them by commas within the
  477. double parentheses: for example, `__attribute__ ((aligned (16),
  478. packed))'.
  479.  
  480. 
  481. File: gcc.info,  Node: Inline,  Next: Extended Asm,  Prev: Alignment,  Up: C Extensions
  482.  
  483. An Inline Function is As Fast As a Macro
  484. ========================================
  485.  
  486.    By declaring a function `inline', you can direct GNU CC to integrate
  487. that function's code into the code for its callers.  This makes
  488. execution faster by eliminating the function-call overhead; in
  489. addition, if any of the actual argument values are constant, their known
  490. values may permit simplifications at compile time so that not all of the
  491. inline function's code needs to be included.  The effect on code size is
  492. less predictable; object code may be larger or smaller with function
  493. inlining, depending on the particular case.  Inlining of functions is an
  494. optimization and it really "works" only in optimizing compilation.  If
  495. you don't use `-O', no function is really inline.
  496.  
  497.    To declare a function inline, use the `inline' keyword in its
  498. declaration, like this:
  499.  
  500.      inline int
  501.      inc (int *a)
  502.      {
  503.        (*a)++;
  504.      }
  505.  
  506.    (If you are writing a header file to be included in ANSI C programs,
  507. write `__inline__' instead of `inline'.  *Note Alternate Keywords::.)
  508.  
  509.    You can also make all "simple enough" functions inline with the
  510. option `-finline-functions'.  Note that certain usages in a function
  511. definition can make it unsuitable for inline substitution.
  512.  
  513.    For C++ programs, GNU CC automatically inlines member functions even
  514. if they are not explicitly declared `inline'.  (You can override this
  515. with `-fno-default-inline'; *note Options Controlling C++ Dialect: C++
  516. Dialect Options..)
  517.  
  518.    When a function is both inline and `static', if all calls to the
  519. function are integrated into the caller, and the function's address is
  520. never used, then the function's own assembler code is never referenced.
  521. In this case, GNU CC does not actually output assembler code for the
  522. function, unless you specify the option `-fkeep-inline-functions'.
  523. Some calls cannot be integrated for various reasons (in particular,
  524. calls that precede the function's definition cannot be integrated, and
  525. neither can recursive calls within the definition).  If there is a
  526. nonintegrated call, then the function is compiled to assembler code as
  527. usual.  The function must also be compiled as usual if the program
  528. refers to its address, because that can't be inlined.
  529.  
  530.    When an inline function is not `static', then the compiler must
  531. assume that there may be calls from other source files; since a global
  532. symbol can be defined only once in any program, the function must not
  533. be defined in the other source files, so the calls therein cannot be
  534. integrated.  Therefore, a non-`static' inline function is always
  535. compiled on its own in the usual fashion.
  536.  
  537.    If you specify both `inline' and `extern' in the function
  538. definition, then the definition is used only for inlining.  In no case
  539. is the function compiled on its own, not even if you refer to its
  540. address explicitly.  Such an address becomes an external reference, as
  541. if you had only declared the function, and had not defined it.
  542.  
  543.    This combination of `inline' and `extern' has almost the effect of a
  544. macro.  The way to use it is to put a function definition in a header
  545. file with these keywords, and put another copy of the definition
  546. (lacking `inline' and `extern') in a library file.  The definition in
  547. the header file will cause most calls to the function to be inlined.
  548. If any uses of the function remain, they will refer to the single copy
  549. in the library.
  550.  
  551.    GNU C does not inline any functions when not optimizing.  It is not
  552. clear whether it is better to inline or not, in this case, but we found
  553. that a correct implementation when not optimizing was difficult.  So we
  554. did the easy thing, and turned it off.
  555.  
  556. 
  557. File: gcc.info,  Node: Extended Asm,  Next: Asm Labels,  Prev: Inline,  Up: C Extensions
  558.  
  559. Assembler Instructions with C Expression Operands
  560. =================================================
  561.  
  562.    In an assembler instruction using `asm', you can now specify the
  563. operands of the instruction using C expressions.  This means no more
  564. guessing which registers or memory locations will contain the data you
  565. want to use.
  566.  
  567.    You must specify an assembler instruction template much like what
  568. appears in a machine description, plus an operand constraint string for
  569. each operand.
  570.  
  571.    For example, here is how to use the 68881's `fsinx' instruction:
  572.  
  573.      asm ("fsinx %1,%0" : "=f" (result) : "f" (angle));
  574.  
  575. Here `angle' is the C expression for the input operand while `result'
  576. is that of the output operand.  Each has `"f"' as its operand
  577. constraint, saying that a floating point register is required.  The `='
  578. in `=f' indicates that the operand is an output; all output operands'
  579. constraints must use `='.  The constraints use the same language used
  580. in the machine description (*note Constraints::.).
  581.  
  582.    Each operand is described by an operand-constraint string followed
  583. by the C expression in parentheses.  A colon separates the assembler
  584. template from the first output operand, and another separates the last
  585. output operand from the first input, if any.  Commas separate output
  586. operands and separate inputs.  The total number of operands is limited
  587. to ten or to the maximum number of operands in any instruction pattern
  588. in the machine description, whichever is greater.
  589.  
  590.    If there are no output operands, and there are input operands, then
  591. there must be two consecutive colons surrounding the place where the
  592. output operands would go.
  593.  
  594.    Output operand expressions must be lvalues; the compiler can check
  595. this.  The input operands need not be lvalues.  The compiler cannot
  596. check whether the operands have data types that are reasonable for the
  597. instruction being executed.  It does not parse the assembler
  598. instruction template and does not know what it means, or whether it is
  599. valid assembler input.  The extended `asm' feature is most often used
  600. for machine instructions that the compiler itself does not know exist.
  601.  
  602.    The output operands must be write-only; GNU CC will assume that the
  603. values in these operands before the instruction are dead and need not be
  604. generated.  Extended asm does not support input-output or read-write
  605. operands.  For this reason, the constraint character `+', which
  606. indicates such an operand, may not be used.
  607.  
  608.    When the assembler instruction has a read-write operand, or an
  609. operand in which only some of the bits are to be changed, you must
  610. logically split its function into two separate operands, one input
  611. operand and one write-only output operand.  The connection between them
  612. is expressed by constraints which say they need to be in the same
  613. location when the instruction executes.  You can use the same C
  614. expression for both operands, or different expressions.  For example,
  615. here we write the (fictitious) `combine' instruction with `bar' as its
  616. read-only source operand and `foo' as its read-write destination:
  617.  
  618.      asm ("combine %2,%0" : "=r" (foo) : "0" (foo), "g" (bar));
  619.  
  620. The constraint `"0"' for operand 1 says that it must occupy the same
  621. location as operand 0.  A digit in constraint is allowed only in an
  622. input operand, and it must refer to an output operand.
  623.  
  624.    Only a digit in the constraint can guarantee that one operand will
  625. be in the same place as another.  The mere fact that `foo' is the value
  626. of both operands is not enough to guarantee that they will be in the
  627. same place in the generated assembler code.  The following would not
  628. work:
  629.  
  630.      asm ("combine %2,%0" : "=r" (foo) : "r" (foo), "g" (bar));
  631.  
  632.    Various optimizations or reloading could cause operands 0 and 1 to
  633. be in different registers; GNU CC knows no reason not to do so.  For
  634. example, the compiler might find a copy of the value of `foo' in one
  635. register and use it for operand 1, but generate the output operand 0 in
  636. a different register (copying it afterward to `foo''s own address).  Of
  637. course, since the register for operand 1 is not even mentioned in the
  638. assembler code, the result will not work, but GNU CC can't tell that.
  639.  
  640.    Some instructions clobber specific hard registers.  To describe
  641. this, write a third colon after the input operands, followed by the
  642. names of the clobbered hard registers (given as strings).  Here is a
  643. realistic example for the Vax:
  644.  
  645.      asm volatile ("movc3 %0,%1,%2"
  646.                    : /* no outputs */
  647.                    : "g" (from), "g" (to), "g" (count)
  648.                    : "r0", "r1", "r2", "r3", "r4", "r5");
  649.  
  650.    If you refer to a particular hardware register from the assembler
  651. code, then you will probably have to list the register after the third
  652. colon to tell the compiler that the register's value is modified.  In
  653. many assemblers, the register names begin with `%'; to produce one `%'
  654. in the assembler code, you must write `%%' in the input.
  655.  
  656.    If your assembler instruction can alter the condition code register,
  657. add `cc' to the list of clobbered registers.  GNU CC on some machines
  658. represents the condition codes as a specific hardware register; `cc'
  659. serves to name this register.  On other machines, the condition code is
  660. handled differently, and specifying `cc' has no effect.  But it is
  661. valid no matter what the machine.
  662.  
  663.    If your assembler instruction modifies memory in an unpredictable
  664. fashion, add `memory' to the list of clobbered registers.  This will
  665. cause GNU CC to not keep memory values cached in registers across the
  666. assembler instruction.
  667.  
  668.    You can put multiple assembler instructions together in a single
  669. `asm' template, separated either with newlines (written as `\n') or with
  670. semicolons if the assembler allows such semicolons.  The GNU assembler
  671. allows semicolons and all Unix assemblers seem to do so.  The input
  672. operands are guaranteed not to use any of the clobbered registers, and
  673. neither will the output operands' addresses, so you can read and write
  674. the clobbered registers as many times as you like.  Here is an example
  675. of multiple instructions in a template; it assumes that the subroutine
  676. `_foo' accepts arguments in registers 9 and 10:
  677.  
  678.      asm ("movl %0,r9;movl %1,r10;call _foo"
  679.           : /* no outputs */
  680.           : "g" (from), "g" (to)
  681.           : "r9", "r10");
  682.  
  683.    Unless an output operand has the `&' constraint modifier, GNU CC may
  684. allocate it in the same register as an unrelated input operand, on the
  685. assumption that the inputs are consumed before the outputs are produced.
  686. This assumption may be false if the assembler code actually consists of
  687. more than one instruction.  In such a case, use `&' for each output
  688. operand that may not overlap an input.  *Note Modifiers::.
  689.  
  690.    If you want to test the condition code produced by an assembler
  691. instruction, you must include a branch and a label in the `asm'
  692. construct, as follows:
  693.  
  694.      asm ("clr %0;frob %1;beq 0f;mov #1,%0;0:"
  695.           : "g" (result)
  696.           : "g" (input));
  697.  
  698. This assumes your assembler supports local labels, as the GNU assembler
  699. and most Unix assemblers do.
  700.  
  701.    Speaking of labels, jumps from one `asm' to another are not
  702. supported.  The compiler's optimizers do not know about these jumps,
  703. and therefore they cannot take account of them when deciding how to
  704. optimize.
  705.  
  706.    Usually the most convenient way to use these `asm' instructions is to
  707. encapsulate them in macros that look like functions.  For example,
  708.  
  709.      #define sin(x)       \
  710.      ({ double __value, __arg = (x);   \
  711.         asm ("fsinx %1,%0": "=f" (__value): "f" (__arg));  \
  712.         __value; })
  713.  
  714. Here the variable `__arg' is used to make sure that the instruction
  715. operates on a proper `double' value, and to accept only those arguments
  716. `x' which can convert automatically to a `double'.
  717.  
  718.    Another way to make sure the instruction operates on the correct
  719. data type is to use a cast in the `asm'.  This is different from using a
  720. variable `__arg' in that it converts more different types.  For
  721. example, if the desired type were `int', casting the argument to `int'
  722. would accept a pointer with no complaint, while assigning the argument
  723. to an `int' variable named `__arg' would warn about using a pointer
  724. unless the caller explicitly casts it.
  725.  
  726.    If an `asm' has output operands, GNU CC assumes for optimization
  727. purposes that the instruction has no side effects except to change the
  728. output operands.  This does not mean that instructions with a side
  729. effect cannot be used, but you must be careful, because the compiler
  730. may eliminate them if the output operands aren't used, or move them out
  731. of loops, or replace two with one if they constitute a common
  732. subexpression.  Also, if your instruction does have a side effect on a
  733. variable that otherwise appears not to change, the old value of the
  734. variable may be reused later if it happens to be found in a register.
  735.  
  736.    You can prevent an `asm' instruction from being deleted, moved
  737. significantly, or combined, by writing the keyword `volatile' after the
  738. `asm'.  For example:
  739.  
  740.      #define set_priority(x)  \
  741.      asm volatile ("set_priority %0": /* no outputs */ : "g" (x))
  742.  
  743. An instruction without output operands will not be deleted or moved
  744. significantly, regardless, unless it is unreachable.
  745.  
  746.    Note that even a volatile `asm' instruction can be moved in ways
  747. that appear insignificant to the compiler, such as across jump
  748. instructions.  You can't expect a sequence of volatile `asm'
  749. instructions to remain perfectly consecutive.  If you want consecutive
  750. output, use a single `asm'.
  751.  
  752.    It is a natural idea to look for a way to give access to the
  753. condition code left by the assembler instruction.  However, when we
  754. attempted to implement this, we found no way to make it work reliably.
  755. The problem is that output operands might need reloading, which would
  756. result in additional following "store" instructions.  On most machines,
  757. these instructions would alter the condition code before there was time
  758. to test it.  This problem doesn't arise for ordinary "test" and
  759. "compare" instructions because they don't have any output operands.
  760.  
  761.    If you are writing a header file that should be includable in ANSI C
  762. programs, write `__asm__' instead of `asm'.  *Note Alternate Keywords::.
  763.  
  764. 
  765. File: gcc.info,  Node: Asm Labels,  Next: Explicit Reg Vars,  Prev: Extended Asm,  Up: C Extensions
  766.  
  767. Controlling Names Used in Assembler Code
  768. ========================================
  769.  
  770.    You can specify the name to be used in the assembler code for a C
  771. function or variable by writing the `asm' (or `__asm__') keyword after
  772. the declarator as follows:
  773.  
  774.      int foo asm ("myfoo") = 2;
  775.  
  776. This specifies that the name to be used for the variable `foo' in the
  777. assembler code should be `myfoo' rather than the usual `_foo'.
  778.  
  779.    On systems where an underscore is normally prepended to the name of
  780. a C function or variable, this feature allows you to define names for
  781. the linker that do not start with an underscore.
  782.  
  783.    You cannot use `asm' in this way in a function *definition*; but you
  784. can get the same effect by writing a declaration for the function
  785. before its definition and putting `asm' there, like this:
  786.  
  787.      extern func () asm ("FUNC");
  788.      
  789.      func (x, y)
  790.           int x, y;
  791.      ...
  792.  
  793.    It is up to you to make sure that the assembler names you choose do
  794. not conflict with any other assembler symbols.  Also, you must not use a
  795. register name; that would produce completely invalid assembler code.
  796. GNU CC does not as yet have the ability to store static variables in
  797. registers.  Perhaps that will be added.
  798.  
  799. 
  800. File: gcc.info,  Node: Explicit Reg Vars,  Next: Alternate Keywords,  Prev: Asm Labels,  Up: C Extensions
  801.  
  802. Variables in Specified Registers
  803. ================================
  804.  
  805.    GNU C allows you to put a few global variables into specified
  806. hardware registers.  You can also specify the register in which an
  807. ordinary register variable should be allocated.
  808.  
  809.    * Global register variables reserve registers throughout the program.
  810.      This may be useful in programs such as programming language
  811.      interpreters which have a couple of global variables that are
  812.      accessed very often.
  813.  
  814.    * Local register variables in specific registers do not reserve the
  815.      registers.  The compiler's data flow analysis is capable of
  816.      determining where the specified registers contain live values, and
  817.      where they are available for other uses.
  818.  
  819.      These local variables are sometimes convenient for use with the
  820.      extended `asm' feature (*note Extended Asm::.), if you want to
  821.      write one output of the assembler instruction directly into a
  822.      particular register.  (This will work provided the register you
  823.      specify fits the constraints specified for that operand in the
  824.      `asm'.)
  825.  
  826. * Menu:
  827.  
  828. * Global Reg Vars::
  829. * Local Reg Vars::
  830.  
  831. 
  832. File: gcc.info,  Node: Global Reg Vars,  Next: Local Reg Vars,  Up: Explicit Reg Vars
  833.  
  834. Defining Global Register Variables
  835. ----------------------------------
  836.  
  837.    You can define a global register variable in GNU C like this:
  838.  
  839.      register int *foo asm ("a5");
  840.  
  841. Here `a5' is the name of the register which should be used.  Choose a
  842. register which is normally saved and restored by function calls on your
  843. machine, so that library routines will not clobber it.
  844.  
  845.    Naturally the register name is cpu-dependent, so you would need to
  846. conditionalize your program according to cpu type.  The register `a5'
  847. would be a good choice on a 68000 for a variable of pointer type.  On
  848. machines with register windows, be sure to choose a "global" register
  849. that is not affected magically by the function call mechanism.
  850.  
  851.    In addition, operating systems on one type of cpu may differ in how
  852. they name the registers; then you would need additional conditionals.
  853. For example, some 68000 operating systems call this register `%a5'.
  854.  
  855.    Eventually there may be a way of asking the compiler to choose a
  856. register automatically, but first we need to figure out how it should
  857. choose and how to enable you to guide the choice.  No solution is
  858. evident.
  859.  
  860.    Defining a global register variable in a certain register reserves
  861. that register entirely for this use, at least within the current
  862. compilation.  The register will not be allocated for any other purpose
  863. in the functions in the current compilation.  The register will not be
  864. saved and restored by these functions.  Stores into this register are
  865. never deleted even if they would appear to be dead, but references may
  866. be deleted or moved or simplified.
  867.  
  868.    It is not safe to access the global register variables from signal
  869. handlers, or from more than one thread of control, because the system
  870. library routines may temporarily use the register for other things
  871. (unless you recompile them specially for the task at hand).
  872.  
  873.    It is not safe for one function that uses a global register variable
  874. to call another such function `foo' by way of a third function `lose'
  875. that was compiled without knowledge of this variable (i.e. in a
  876. different source file in which the variable wasn't declared).  This is
  877. because `lose' might save the register and put some other value there.
  878. For example, you can't expect a global register variable to be
  879. available in the comparison-function that you pass to `qsort', since
  880. `qsort' might have put something else in that register.  (If you are
  881. prepared to recompile `qsort' with the same global register variable,
  882. you can solve this problem.)
  883.  
  884.    If you want to recompile `qsort' or other source files which do not
  885. actually use your global register variable, so that they will not use
  886. that register for any other purpose, then it suffices to specify the
  887. compiler option `-ffixed-REG'.  You need not actually add a global
  888. register declaration to their source code.
  889.  
  890.    A function which can alter the value of a global register variable
  891. cannot safely be called from a function compiled without this variable,
  892. because it could clobber the value the caller expects to find there on
  893. return.  Therefore, the function which is the entry point into the part
  894. of the program that uses the global register variable must explicitly
  895. save and restore the value which belongs to its caller.
  896.  
  897.    On most machines, `longjmp' will restore to each global register
  898. variable the value it had at the time of the `setjmp'.  On some
  899. machines, however, `longjmp' will not change the value of global
  900. register variables.  To be portable, the function that called `setjmp'
  901. should make other arrangements to save the values of the global register
  902. variables, and to restore them in a `longjmp'.  This way, the same
  903. thing will happen regardless of what `longjmp' does.
  904.  
  905.    All global register variable declarations must precede all function
  906. definitions.  If such a declaration could appear after function
  907. definitions, the declaration would be too late to prevent the register
  908. from being used for other purposes in the preceding functions.
  909.  
  910.    Global register variables may not have initial values, because an
  911. executable file has no means to supply initial contents for a register.
  912.  
  913.    On the Sparc, there are reports that g3 ... g7 are suitable
  914. registers, but certain library functions, such as `getwd', as well as
  915. the subroutines for division and remainder, modify g3 and g4.  g1 and
  916. g2 are local temporaries.
  917.  
  918.    On the 68000, a2 ... a5 should be suitable, as should d2 ... d7.  Of
  919. course, it will not do to use more than a few of those.
  920.  
  921. 
  922. File: gcc.info,  Node: Local Reg Vars,  Prev: Global Reg Vars,  Up: Explicit Reg Vars
  923.  
  924. Specifying Registers for Local Variables
  925. ----------------------------------------
  926.  
  927.    You can define a local register variable with a specified register
  928. like this:
  929.  
  930.      register int *foo asm ("a5");
  931.  
  932. Here `a5' is the name of the register which should be used.  Note that
  933. this is the same syntax used for defining global register variables,
  934. but for a local variable it would appear within a function.
  935.  
  936.    Naturally the register name is cpu-dependent, but this is not a
  937. problem, since specific registers are most often useful with explicit
  938. assembler instructions (*note Extended Asm::.).  Both of these things
  939. generally require that you conditionalize your program according to cpu
  940. type.
  941.  
  942.    In addition, operating systems on one type of cpu may differ in how
  943. they name the registers; then you would need additional conditionals.
  944. For example, some 68000 operating systems call this register `%a5'.
  945.  
  946.    Eventually there may be a way of asking the compiler to choose a
  947. register automatically, but first we need to figure out how it should
  948. choose and how to enable you to guide the choice.  No solution is
  949. evident.
  950.  
  951.    Defining such a register variable does not reserve the register; it
  952. remains available for other uses in places where flow control determines
  953. the variable's value is not live.  However, these registers are made
  954. unavailable for use in the reload pass.  I would not be surprised if
  955. excessive use of this feature leaves the compiler too few available
  956. registers to compile certain functions.
  957.  
  958. 
  959. File: gcc.info,  Node: Alternate Keywords,  Next: Incomplete Enums,  Prev: Explicit Reg Vars,  Up: C Extensions
  960.  
  961. Alternate Keywords
  962. ==================
  963.  
  964.    The option `-traditional' disables certain keywords; `-ansi'
  965. disables certain others.  This causes trouble when you want to use GNU C
  966. extensions, or ANSI C features, in a general-purpose header file that
  967. should be usable by all programs, including ANSI C programs and
  968. traditional ones.  The keywords `asm', `typeof' and `inline' cannot be
  969. used since they won't work in a program compiled with `-ansi', while
  970. the keywords `const', `volatile', `signed', `typeof' and `inline' won't
  971. work in a program compiled with `-traditional'.
  972.  
  973.    The way to solve these problems is to put `__' at the beginning and
  974. end of each problematical keyword.  For example, use `__asm__' instead
  975. of `asm', `__const__' instead of `const', and `__inline__' instead of
  976. `inline'.
  977.  
  978.    Other C compilers won't accept these alternative keywords; if you
  979. want to compile with another compiler, you can define the alternate
  980. keywords as macros to replace them with the customary keywords.  It
  981. looks like this:
  982.  
  983.      #ifndef __GNUC__
  984.      #define __asm__ asm
  985.      #endif
  986.  
  987.    `-pedantic' causes warnings for many GNU C extensions.  You can
  988. prevent such warnings within one expression by writing `__extension__'
  989. before the expression.  `__extension__' has no effect aside from this.
  990.  
  991. 
  992. File: gcc.info,  Node: Incomplete Enums,  Next: Function Names,  Prev: Alternate Keywords,  Up: C Extensions
  993.  
  994. Incomplete `enum' Types
  995. =======================
  996.  
  997.    You can define an `enum' tag without specifying its possible values.
  998. This results in an incomplete type, much like what you get if you write
  999. `struct foo' without describing the elements.  A later declaration
  1000. which does specify the possible values completes the type.
  1001.  
  1002.    You can't allocate variables or storage using the type while it is
  1003. incomplete.  However, you can work with pointers to that type.
  1004.  
  1005.    This extension may not be very useful, but it makes the handling of
  1006. `enum' more consistent with the way `struct' and `union' are handled.
  1007.  
  1008. 
  1009. File: gcc.info,  Node: Function Names,  Prev: Incomplete Enums,  Up: C Extensions
  1010.  
  1011. Function Names as Strings
  1012. =========================
  1013.  
  1014.    GNU CC predefines two string variables to be the name of the current
  1015. function.  The variable `__FUNCTION__' is the name of the function as
  1016. it appears in the source.  The variable `__PRETTY_FUNCTION__' is the
  1017. name of the function pretty printed in a language specific fashion.
  1018.  
  1019.    These names are always the same in a C function, but in a C++
  1020. function they may be different.  For example, this program:
  1021.  
  1022.      extern "C" {
  1023.      extern int printf (char *, ...);
  1024.      }
  1025.      
  1026.      class a {
  1027.       public:
  1028.        sub (int i)
  1029.          {
  1030.            printf ("__FUNCTION__ = %s\n", __FUNCTION__);
  1031.            printf ("__PRETTY_FUNCTION__ = %s\n", __PRETTY_FUNCTION__);
  1032.          }
  1033.      };
  1034.      
  1035.      int
  1036.      main (void)
  1037.      {
  1038.        a ax;
  1039.        ax.sub (0);
  1040.        return 0;
  1041.      }
  1042.  
  1043. gives this output:
  1044.  
  1045.      __FUNCTION__ = sub
  1046.      __PRETTY_FUNCTION__ = int  a::sub (int)
  1047.  
  1048. 
  1049. File: gcc.info,  Node: C++ Extensions,  Next: Trouble,  Prev: C Extensions,  Up: Top
  1050.  
  1051. Extensions to the C++ Language
  1052. ******************************
  1053.  
  1054.    The GNU compiler provides these extensions to the C++ language (and
  1055. you can also use most of the C language extensions in your C++
  1056. programs).  If you want to write code that checks whether these
  1057. features are available, you can test for the GNU compiler the same way
  1058. as for C programs: check for a predefined macro `__GNUC__'.  You can
  1059. also use `__GNUG__' to test specifically for GNU C++ (*note Standard
  1060. Predefined Macros: (cpp.info)Standard Predefined.).
  1061.  
  1062. * Menu:
  1063.  
  1064. * Naming Results::      Giving a name to C++ function return values.
  1065. * Min and Max::        C++ Minimum and maximum operators.
  1066. * Destructors and Goto:: Goto is safe to use in C++ even when destructors
  1067.                            are needed.
  1068. * C++ Interface::       You can use a single C++ header file for both
  1069.                          declarations and definitions.
  1070. * C++ Signatures::    You can specify abstract types to get subtype
  1071.              polymorphism independent from inheritance.
  1072.  
  1073. 
  1074. File: gcc.info,  Node: Naming Results,  Next: Min and Max,  Up: C++ Extensions
  1075.  
  1076. Named Return Values in C++
  1077. ==========================
  1078.  
  1079.    GNU C++ extends the function-definition syntax to allow you to
  1080. specify a name for the result of a function outside the body of the
  1081. definition, in C++ programs:
  1082.  
  1083.      TYPE
  1084.      FUNCTIONNAME (ARGS) return RESULTNAME;
  1085.      {
  1086.        ...
  1087.        BODY
  1088.        ...
  1089.      }
  1090.  
  1091.    You can use this feature to avoid an extra constructor call when a
  1092. function result has a class type.  For example, consider a function
  1093. `m', declared as `X v = m ();', whose result is of class `X':
  1094.  
  1095.      X
  1096.      m ()
  1097.      {
  1098.        X b;
  1099.        b.a = 23;
  1100.        return b;
  1101.      }
  1102.  
  1103.    Although `m' appears to have no arguments, in fact it has one
  1104. implicit argument: the address of the return value.  At invocation, the
  1105. address of enough space to hold `v' is sent in as the implicit argument.
  1106. Then `b' is constructed and its `a' field is set to the value 23.
  1107. Finally, a copy constructor (a constructor of the form `X(X&)') is
  1108. applied to `b', with the (implicit) return value location as the
  1109. target, so that `v' is now bound to the return value.
  1110.  
  1111.    But this is wasteful.  The local `b' is declared just to hold
  1112. something that will be copied right out.  While a compiler that
  1113. combined an "elision" algorithm with interprocedural data flow analysis
  1114. could conceivably eliminate all of this, it is much more practical to
  1115. allow you to assist the compiler in generating efficient code by
  1116. manipulating the return value explicitly, thus avoiding the local
  1117. variable and copy constructor altogether.
  1118.  
  1119.    Using the extended GNU C++ function-definition syntax, you can avoid
  1120. the temporary allocation and copying by naming `r' as your return value
  1121. as the outset, and assigning to its `a' field directly:
  1122.  
  1123.      X
  1124.      m () return r;
  1125.      {
  1126.        r.a = 23;
  1127.      }
  1128.  
  1129. The declaration of `r' is a standard, proper declaration, whose effects
  1130. are executed *before* any of the body of `m'.
  1131.  
  1132.    Functions of this type impose no additional restrictions; in
  1133. particular, you can execute `return' statements, or return implicitly by
  1134. reaching the end of the function body ("falling off the edge").  Cases
  1135. like
  1136.  
  1137.      X
  1138.      m () return r (23);
  1139.      {
  1140.        return;
  1141.      }
  1142.  
  1143. (or even `X m () return r (23); { }') are unambiguous, since the return
  1144. value `r' has been initialized in either case.  The following code may
  1145. be hard to read, but also works predictably:
  1146.  
  1147.      X
  1148.      m () return r;
  1149.      {
  1150.        X b;
  1151.        return b;
  1152.      }
  1153.  
  1154.    The return value slot denoted by `r' is initialized at the outset,
  1155. but the statement `return b;' overrides this value.  The compiler deals
  1156. with this by destroying `r' (calling the destructor if there is one, or
  1157. doing nothing if there is not), and then reinitializing `r' with `b'.
  1158.  
  1159.    This extension is provided primarily to help people who use
  1160. overloaded operators, where there is a great need to control not just
  1161. the arguments, but the return values of functions.  For classes where
  1162. the copy constructor incurs a heavy performance penalty (especially in
  1163. the common case where there is a quick default constructor), this is a
  1164. major savings.  The disadvantage of this extension is that you do not
  1165. control when the default constructor for the return value is called: it
  1166. is always called at the beginning.
  1167.  
  1168. 
  1169. File: gcc.info,  Node: Min and Max,  Next: Destructors and Goto,  Prev: Naming Results,  Up: C++ Extensions
  1170.  
  1171. Minimum and Maximum Operators in C++
  1172. ====================================
  1173.  
  1174.    It is very convenient to have operators which return the "minimum"
  1175. or the "maximum" of two arguments.  In GNU C++ (but not in GNU C),
  1176.  
  1177. `A <? B'
  1178.      is the "minimum", returning the smaller of the numeric values A
  1179.      and B;
  1180.  
  1181. `A >? B'
  1182.      is the "maximum", returning the larger of the numeric values A and
  1183.      B.
  1184.  
  1185.    These operations are not primitive in ordinary C++, since you can
  1186. use a macro to return the minimum of two things in C++, as in the
  1187. following example.
  1188.  
  1189.      #define MIN(X,Y) ((X) < (Y) ? : (X) : (Y))
  1190.  
  1191. You might then use `int min = MIN (i, j);' to set MIN to the minimum
  1192. value of variables I and J.
  1193.  
  1194.    However, side effects in `X' or `Y' may cause unintended behavior.
  1195. For example, `MIN (i++, j++)' will fail, incrementing the smaller
  1196. counter twice.  A GNU C extension allows you to write safe macros that
  1197. avoid this kind of problem (*note Naming an Expression's Type: Naming
  1198. Types.).  However, writing `MIN' and `MAX' as macros also forces you to
  1199. use function-call notation notation for a fundamental arithmetic
  1200. operation.  Using GNU C++ extensions, you can write `int min = i <? j;'
  1201. instead.
  1202.  
  1203.    Since `<?' and `>?' are built into the compiler, they properly
  1204. handle expressions with side-effects;  `int min = i++ <? j++;' works
  1205. correctly.
  1206.  
  1207. 
  1208. File: gcc.info,  Node: Destructors and Goto,  Next: C++ Interface,  Prev: Min and Max,  Up: C++ Extensions
  1209.  
  1210. `goto' and Destructors in GNU C++
  1211. =================================
  1212.  
  1213.    In C++ programs, you can safely use the `goto' statement.  When you
  1214. use it to exit a block which contains aggregates requiring destructors,
  1215. the destructors will run before the `goto' transfers control.  (In ANSI
  1216. C++, `goto' is restricted to targets within the current block.)
  1217.  
  1218.    The compiler still forbids using `goto' to *enter* a scope that
  1219. requires constructors.
  1220.  
  1221.