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.
C Calling Convention (/Gd)
◄Up► ◄Contents► ◄Index► ◄Back►
─────C/C++ Compiler─────────────────────────────────────────────────────────
The /Gd option has the same effect as the __cdecl keyword. It
specifies that the entire module should use the C calling
convention. This option is on by default.
For the C calling convention, the rightmost argument is pushed on
the stack first, the leftmost last. The C naming convention
prepends two underscores to the name that is placed into the
object file; no case translation is done.
The __cdecl keyword in C is the inverse of the __fortran and
__pascal keywords. When applied to a function or function pointer,
__cdecl indicates that the associated function is to be called
using the normal C calling convention. This allows you to write C
programs that take advantage of the more efficient Pascal/FORTRAN
calling convention while still having access to the entire C
library, other C objects, and even user-defined functions that
accept variable-length argument lists. The __cdecl keyword takes
precedence over the /Gc option.
For convenience, the __cdecl keyword has already been applied to
run-time-library function declarations in the include files
distributed with the compiler. Therefore, your C programs can call
the library functions freely, no matter which calling conventions
you compile with. Make sure to use the appropriate include file
for each library function the program calls.
See also: ◄Pascal Calling Convention►
◄Fastcall Calling Convention►
-♦-