home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.msdos.programmer
- Path: sparky!uunet!cs.utexas.edu!torn!news.ccs.queensu.ca!slip201.telnet1.QueensU.CA!dmurdoch
- From: dmurdoch@mast.queensu.ca (Duncan Murdoch)
- Subject: Re: Calling convention: C vs PASCAL
- Message-ID: <dmurdoch.225.724125846@mast.queensu.ca>
- Lines: 23
- Sender: news@knot.ccs.queensu.ca (Netnews control)
- Organization: Queen's University
- References: <1992Dec11.225015.26304@eng.ufl.edu>
- Date: Sat, 12 Dec 1992 02:04:07 GMT
-
- 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.
-
- 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
-