Article View: comp.windows.x
Article #38352Re: C++ and callbacks
From: mat
Date: Wed, 11 May 1994 19:28
Date: Wed, 11 May 1994 19:28
37 lines
2697 bytes
2697 bytes
In article <CpJKJz.KBD@news.cis.umn.edu>, ianhogg@milli.cs.umn.edu (Ian J Hogg) writes: > In article <JASON.94May6154541@deneb.cygnus.com> jason@cygnus.com (Jason Merrill) writes: > >>>>>> Ian J Hogg <ianhogg@milli.cs.umn.edu> writes: > > > >> ... I know of at least one compiler that passes arguments for C++ > >> linkage functions differently than C linkage functions. ... > >... It does seem strange to me that they would alter the calling > >convention ... > ... Zortech ... claimed [it] was more efficient. The 8086 processor family has two different ways to do a return from a function. If the _called_ function knows how many argument bytes were pushed on the stack, it can add an operand to the return instruction; the return will adjust the stack pointer back over the arguments while the processor is locating and fetching the next instruction to execute after the return. This is sometimes called the Pascal Calling Sequence. If the _called_ function is unsure of how many argument bytes were passed, it cannot do this and the _calling_ function must include code to adjust the stack pointer. This takes extra time, and it occurs once for every call of the function instead of once for every definition. This is sometimes called the C Calling Sequence. For C, because not every function must be prototyped, the compiler cannot assume that the correct number of argument bytes were pushed on the stack. The faster Pascal Calling Sequence cannot be used. For C++, because every function must be prototyped, the Pascal Calling Sequence _can_ be used _except_ for functions whose signature includes the ellipsis. -- (This man's opinions are his own.) From mole-end Mark Terribile mat@mole-end.matawan.nj.us, Somewhere in Matawan, NJ (Training and consulting in C, C++, UNIX, etc.)
Technical Details
Message-ID:
<1994May11.192852.19009@mole-end.matawan.nj.us>Path:
arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!get.hooked.net!decwrl!hookup!usc!howland.reston.ans.net!pipex!uknet!EU.net!uunet!mole-end!matReferences:
<JASON.94May5173436@deneb.cygnus.com> <CpEBxp.9w2@news.cis.umn.edu> <CpJKJz.KBD@news.cis.umn.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 109fba,ad5a39011a2d3d26 X-Google-Attributes: gid109fba,public X-Google-Thread: 103734,ad5a39011a2d3d26 X-Google-Attributes: gid103734,public X-Google-Thread: 10ba33,ad5a39011a2d3d26 X-Google-Attributes: gid10ba33,public X-Google-ArrivalTime: 1994-05-12 08:09:37 PST Newsgroups: comp.windows.x,comp.lang.c++,gnu.g++.help Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!get.hooked.net!decwrl!hookup!usc!howland.reston.ans.net!pipex!uknet!EU.net!uunet!mole-end!mat From: mat@mole-end.matawan.nj.us Subject: Re: C++ and callbacks Message-ID: <1994May11.192852.19009@mole-end.matawan.nj.us> Summary: Calling Conventions Organization: : References: <JASON.94May5173436@deneb.cygnus.com> <CpEBxp.9w2@news.cis.umn.edu> <CpJKJz.KBD@news.cis.umn.edu> Date: Wed, 11 May 1994 19:28:52 GMT Lines: 37