Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

calling conventions in g++

723 views
Skip to first unread message

Roger Ding

unread,
Jul 14, 1999, 3:00:00 AM7/14/99
to
VC++ supports several different conventions for calling functions.
(__cdecl, __stdcall, __fastcall, ...)

How about g++?

thanks,
Roger Ding
roger...@intel.com


Kaz Kylheku

unread,
Jul 14, 1999, 3:00:00 AM7/14/99
to
On Wed, 14 Jul 1999 15:11:52 -0700, Roger Ding <roger...@intel.com> wrote:
In comp.os.linux.development.apps, you wrote:
>VC++ supports several different conventions for calling functions.
>(__cdecl, __stdcall, __fastcall, ...)
>
>How about g++?

You don't need these ``features'' in g++, because you don't have a
proliferation of competing standards to glue together, but one system-wide
calling convention.

The __cdecl is replaced by an ANSI C++ standard linkage specification,
namely extern "C".

You can influence calling conventions to some extent using __attribute(())
but the need to do this is extremely rare. For example, you could use it to
tell gcc on Intel to use registers for passing parameters.

Mumit Khan

unread,
Jul 15, 1999, 3:00:00 AM7/15/99
to
In article <slrn7oq3v...@ashi.footprints.net>,

Kaz Kylheku <k...@ashi.FootPrints.net> wrote:
>On Wed, 14 Jul 1999 15:11:52 -0700, Roger Ding <roger...@intel.com> wrote:
>In comp.os.linux.development.apps, you wrote:
>>VC++ supports several different conventions for calling functions.
>>(__cdecl, __stdcall, __fastcall, ...)
>>
>>How about g++?

g++ supports cdecl and stdcall attributes on all x86 targets. See the
documentation for more info.

$ info gcc index "Function Attributes"

>
>You don't need these ``features'' in g++, because you don't have a
>proliferation of competing standards to glue together, but one system-wide
>calling convention.

Correct in general. Unless you are interfacing to something that needs
special calling conventions, don't touch these.

>The __cdecl is replaced by an ANSI C++ standard linkage specification,
>namely extern "C".

Wrong. Those two are completely different things. One is calling
convention, and the other is linkage specification. They can be both
specified at the same time.

Regards,
Mumit


0 new messages