Re: problem with solaris compiler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Priya,

> 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):
http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Function-Attributes.html

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux