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

Re: [f-cpu] calling conventions

On Thu, Jun 06, 2002 at 06:02:44AM -0700, John Graley wrote:
> I'm new to this list - if it's OK with you guys I'd like to make a few
> comments about calling conventions:

You're welcome.

>  - Calling conventions are usually language-specific. So, for example, you
> could specify the C calling convention seperately and independently of the
> Lisp calling convention. 

Maybe `calling conventions' is the wrong term. We're talking about a
generic programming model that should be suitable for most languages
and compilers. Lisp is definitely an exception, Forth is another one.
But for C-, Pascal- or Fortran-style languages (and assembler routines
called by them) it's an excellent idea to have a universal model that
fits all.

>  - Compilers usually offer ways of calling into conventions for other
> languages when it is feasable. However, these are not used a great deal[1] -
> when programmers write components of their system in different languages,
> they usually run them as seperate operating system processes. 

That's only half true (in binary: 0.5 ;). On Unix/Linux, most programs
use the underlying C run-time library, even if they were written in C++,
Pascal, Fortran or Ada. You may not be aware of it, but any program
that's not written in C is, in fact, a multi-language application.

> [1] For a while, most or all Windows API funcitons used pascal calling
> convention, and C code had to specify this. But it's not difficult to call
> pascal from C.

Not at all. Although Microsoft made a big fuss of it...

BTW: IIRC this started with OS/2, not Windows.

>  - In the case of C, functions with >13 parameters are rare, and var-args
> calls are very rare. (printf et. al. are already super slooooow)

Varargs calls may be rare compared to the total number of system calls,
but they're present in almost any C program. That does not mean that we
have to find an efficient way to do varargs functions. As I said before,
I want the `regular' (fixed-args) functions to be as fast as possible.

 Michael "Tired" Riepe <Michael.Riepe@stud.uni-hannover.de>
 "All I wanna do is have a little fun before I die"
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/