Article View: comp.os.msdos.programmer
Article #6408Re: Calling convention: C vs PASCAL
From: Duco Fijma
Date: Mon, 14 Dec 1992 11:45
Date: Mon, 14 Dec 1992 11:45
37 lines
2220 bytes
2220 bytes
In article <dmurdoch.225.724125846@mast.queensu.ca>, dmurdoch@mast.queensu.ca (Duncan Murdoch) writes: |> In article <1992Dec11.225015.26304@eng.ufl.edu> zzang@stat.ufl.edu (zzang) writes: |> >the C pushs the arg from right to left onto |> >the stack when calling a function. |> >the PASCAL pushs the args from left to right. |> >I was told that the C calling convention results |> >in larger as well as slower program. |> >(due to some cleanup work of the stack after call??) |> |> I don't think the parameter order makes any difference to calling efficiency. |> |> The important difference between standard C and Pascal calling conventions |> is that in C, it's up to the caller to clean up the stack, while in Pascal |> it's up to the called routine. It's this difference that gives the Pascal |> convention the edge: every time you call a C-convention routine you need to |> fix up the stack afterward, while a Pascal-convention routine does |> it in just one place. On a PC, there's even a special form of RET to |> support the Pascal convention. Waht difference does this make for execution time? The cleanup code has to be executed for every invocation, whether it is included with the callers or the called code. Of course it does make difference for the code size. |> The advantage of the C convention is that it makes it easy to call routines |> variable numbers of parameters. |> |> Duncan Murdoch |> dmurdoch@mast.queensu.ca -- Duco Fijma tel. X31-53-893718 University of Twente fax. X31-53-893811 P.O. Box 217 internet: fijma@cs.utwente.nl 7500 AE Enschede The Netherlands | No ugly pictures in this sig! |
Technical Details
Message-ID:
<1992Dec14.124529@cs.utwente.nl>Path:
arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!utrcu1!infnews!infnews!fijmaReferences:
<1992Dec11.225015.26304@eng.ufl.edu> <dmurdoch.225.724125846@mast.queensu.ca>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!sun4nl!utrcu1!infnews!infnews!fijma From: fijma@cs.utwente.nl (Duco Fijma) Subject: Re: Calling convention: C vs PASCAL Message-ID: <1992Dec14.124529@cs.utwente.nl> Sender: usenet@cs.utwente.nl Nntp-Posting-Host: utis143 Organization: University of Twente, Dept. of Computer Science References: <1992Dec11.225015.26304@eng.ufl.edu> <dmurdoch.225.724125846@mast.queensu.ca> Date: Mon, 14 Dec 1992 11:45:29 GMT Lines: 37