Mail Archives: djgpp/1997/08/07/12:29:25
Shawn Hargreaves (Shawn AT talula DOT demon DOT co DOT uk) writes:
> This produces:
>
> .align 4
> .globl _returntest
> _returntest:
> movl _x,%eax
> ret
Some C++ programs (maybe C also for structs) return entire structs and
objects! Is this done implicitly by reference, using a pointer in eax?
(I myself avoid any possible excess slow copying of data by using explicit
references in my C++ object-returning functions, as in:
vector &operator+ (vector &u, vector &v) {
vector t;
t.set(u.x+v.x,u.y+v.y,u.z+v.z);
return t;
}
I assume for these the "vector &" is definitely passed in eax as an address.
--
.*. Where feelings are concerned, answers are rarely simple [GeneDeWeese]
-() < When I go to the theater, I always go straight to the "bag and mix"
`*' bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh
- Raw text -