C vs. FORTRAN

Leo de Wit leo at philmds.UUCP
Wed Jul 6 08:22:39 AEST 1988


In article <872 at garth.UUCP> smryan at garth.UUCP (Steven Ryan) writes:
>Actually, the real discussion is why does C have such a crippled argument
>list? It is possible to pass a list of argument descriptors. The descriptor
>list can be staticcally created and the overhead is just a register load
>of a relocated address.

What's the big deal? You can do that already in C. Just pass a list of
pointers to structs, they are equivalent to your 'descriptors'. Both
the structs and the pointers can be either statically allocated (so no
arguments are pushed on the stack) or pushed onto the stack (the
pointers, or even the structs themselves).

About the overhead:  you forgot to mention assignment to the data
elements; for instance an actual parameter that is an expression -
often calculated first into a register - has to be stored first into
the static area before the function can be called; there are a lot of
architectures that store much faster using stack pointer indirection
than using an absolute address (or even address register with offset).
And the data register still has to be loaded (I'm entitled to call this
overhead if the Fortran crew calls adjusting a stack pointer or setting
up a stack frame overhead; the last two instructions being even faster
than loading registers).

C has such a crippled argument list? I find it perfectly ok if you
don't like C - that's all on your account - but if you shout 'C has bad
this - C has bad that' you should argue that; things you take for
granted could well be less self-evident for C programmers. As far as I
can C (8-) - but you're of course free to correct me - C has at least
as many ways of passing parameters as Fortran.

      Leo.



More information about the Comp.lang.c mailing list