This is the mail archive of the
mailing list for the GCC project.
Re: problem with solaris compiler
- From: John Love-Jensen <eljay at adobe dot com>
- To: Priya Sinha <pucsd dot priya at gmail dot com>, MSX to GCC <gcc-help at gcc dot gnu dot org>
- Date: Mon, 27 Nov 2006 08:23:28 -0600
- Subject: Re: problem with solaris compiler
> why does a compiler push the arguments from left to right or right to
> left in a function call (especially with respect to gcc)?
GCC uses the calling convention that is appropriate for the platform.
There are several (many?) different calling conventions, of which GCC
supports a variety of them.
A calling convention covers these kinds of things:
+ what order are the arguments pushed on the stack...
+ ...or are arguments passed in by registers
+ who is responsible for popping the arguments
+ how is the name decorated
Some calling conventions are particular to a given language or operating
system, hence people might refer to "the Pascal calling convention", or "the
Windows calling convention", or the "SPARC ABI".
GCC uses the calling convention that is appropriate for the platform
(operating system + language). Sometimes you need finer control over the
calling convention used, rather than use the default -- that's where the
__attribute__ facilities come into play.
Here's the GCC online documentation on the topic (the information is
scattered throughout the HTML page):