Re: "standard" C calling convention?

"Glen Herrmannsfeldt" <gah@ugcs.caltech.edu>
13 Feb 2003 00:48:59 -0500

          From comp.compilers

Related articles
"standard" C calling convention? peter@javamonkey.com (Peter Seibel) (2003-02-12)
Re: "standard" C calling convention? nmm1@cus.cam.ac.uk (2003-02-13)
Re: "standard" C calling convention? jgd@cix.co.uk (2003-02-13)
Re: "standard" C calling convention? gah@ugcs.caltech.edu (Glen Herrmannsfeldt) (2003-02-13)
Re: "standard" C calling convention? lars@bearnip.com (2003-02-13)
Re: "standard" C calling convention? dmr@bell-labs.com (Dennis Ritchie) (2003-02-21)
Re: "standard" C calling convention? christian.bau@cbau.freeserve.co.uk (Christian Bau) (2003-02-21)
Re: "standard" C calling convention? mgl8@attbi.com (Mike Ludwig) (2003-02-21)
Re: "standard" C calling convention? sander@haldjas.folklore.ee (Sander Vesik) (2003-02-21)
Re: "standard" C calling convention? andrew.higham@blueyonder.co.uk (Andrew) (2003-02-21)
[7 later articles]
| List of all articles for this month |

From: "Glen Herrmannsfeldt" <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: 13 Feb 2003 00:48:59 -0500
Organization: AT&T Broadband
References: 03-02-072
Keywords: C, standards
Posted-Date: 13 Feb 2003 00:48:58 EST

"Peter Seibel" <peter@javamonkey.com> wrote in message
> People often refer to the "standard C calling convention", usually as
> opposed to some other calling convention that a compiler also
> supports. I have several questions, in no particular order about this
> "standard".
>
> - Am I correct in assuming that this is more of an de facto than de
> jure standard.


Well, many OS have somewhat of a standard, and C programs on that OS
may or may not use it. C requires the ability to call with a variable
number of arguments, which restricts somewhat the allowable calling
conventions. (x86 has hardware support for a calling convention in
which the called routine removes arguments from the stack. This is
sometimes called the Pascal convention, and doesn't work well for C.)


It is desirable to be able to call between different languages.
Sometimes that requires C programs to pass the address of a variable
instead of the value as C normally would do.


-- glen


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.