C++ Calling Conventions

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Sat Feb 5 07:27:00 GMT 2000


> Can anyone point me towards information describing calling conventions
> for C++?

The information is spread all over the world. Typically, C++ compilers
conform to the C calling conventions for pure C code, and only extend
those. So the various C ABI specifications provide a starting
point. Another starting point is the ARM.

> Do the ANSI/ISO standards specify calling conventions? Or are they
> compiler specific?

The standard does not specify an ABI; so far, they are compiler
specific. For g++, you'll find more information in gxxint.texi.

> Can the above mentioned standards be downloaded from anywhere, or does
> one have to buy them?

A C++ ABI is under development for C++; you can find the existing
pieces at

http://reality.sgi.com/dehnert_engr/cxx/cxx-summary.html

> I'm particularly interested in method invocation is implemented,
> especially virtual method invocation.

In most compilers, (non-static) methods take an additional implicit
parameter, representing 'this'. This parameter is typically
implemented passed as a pointer, and as the first argument.

Virtual methods are typically implemented by means of a 'virtual
function table'. You'll find more about these in gxxint.texi.

Regards,
Martin



More information about the Gcc mailing list