public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* problem with solaris compiler
@ 2006-11-27 13:33 Priya Sinha
  2006-11-27 14:23 ` John Love-Jensen
  0 siblings, 1 reply; 2+ messages in thread
From: Priya Sinha @ 2006-11-27 13:33 UTC (permalink / raw)
  To: gcc-help

Hi,
why does a compiler push the arguments from left to right or right to
left in a function call (especially with respect to gcc)?
Priya

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: problem with solaris compiler
  2006-11-27 13:33 problem with solaris compiler Priya Sinha
@ 2006-11-27 14:23 ` John Love-Jensen
  0 siblings, 0 replies; 2+ messages in thread
From: John Love-Jensen @ 2006-11-27 14:23 UTC (permalink / raw)
  To: Priya Sinha, MSX to GCC

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-11-27 14:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-27 13:33 problem with solaris compiler Priya Sinha
2006-11-27 14:23 ` John Love-Jensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).