C/C++ Compiler (cl.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Calling Conventions (/Gr, /Gc, /Gd)
                                             Up Contents Index Back
─────C/C++ Compiler─────────────────────────────────────────────────────────
 
     Syntax:  /Gr
              /Gc
              /Gd
 
     The Fastcall (/Gr) option enables the __fastcall function calling
     convention. The convention applies to functions not explicitly
     given the __cdecl, __pascal, or __fortran attributes. When you use
     this option, make sure you use the standard include files. Without
     these include files, you get unresolved externals.
 
     The __fastcall convention combines the ability to pass arguments
     in registers (rather than on the stack) with different return
     conventions for floating-point values. Floating-point values are
     returned on the floating-point stack.
 
     The varargs and stdargs macros cannot be used in functions that
     use the __fastcall calling convention. The naming convention is
     similar to that for __cdecl, leading @, and mixed case.
 
     The Pascal (/Gc) option makes the FORTRAN/Pascal calling and
     naming conventions the default. This enables your programs to call
     and be called by functions written in FORTRAN, Pascal, and BASIC.
     You can override this option case by case with the __cdecl or
     __fastcall keyword.
 
     The C (/Gd) option makes __cdecl calling and naming conventions
     the default. Because /Ox causes all functions to default to
     __fastcall, using /Gd is a good way to get maximum optimization
     without register-calling conventions.
 
     NOTE: The pascal, fortran, and cdecl keywords (like the near, far,
           and huge keywords) are disabled by the ANSI C (/Za) option.
           If you use /Za, these names are treated as ordinary
           identifiers rather than keywords. The underscore versions
           (__pascal, __fortran, __cdecl, __near, __far, and __huge)
           are always available.
 
     See also: Enabling and Disabling Language Extensions
               Restricting Length of External Names
                                    -♦-