www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/16/10:30:31

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Assembly returns...
Date: Sat, 16 May 1998 09:39:03 -0400
Organization: Two pounds of chaos and a pinch of salt.
Lines: 20
Message-ID: <355D96F7.7624@cs.com>
References: <pf671.1180$qR3 DOT 4125743 AT news20 DOT bellglobal DOT com>
NNTP-Posting-Host: ppp104.cs.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Paul Derbyshire wrote:
> 
> I suppose objects bigger than 32 bits are implicitly passed by reference using
> a pointer in eax, and the temporary is deleted only after receipt of the value
> in the caller?

I think that's correct.  However, if memory serves, such structs are not
returned by reference but by value; a separate copy is placed on the
stack and its address is returned in eax.  If this is correct, then your
huge class might cause a stack overflow if you tried to return it by
value.  The best way to find out is probably to compile such code with
the -S flag and examine the resulting assembly.

-- 
---------------------------------------------------------------------
|      John M. Aldrich       |"Men rarely (if ever) manage to dream |
|       aka Fighteer I       |up a god superior to themselves. Most |
|   mailto:fighteer AT cs DOT com   |gods have the manners and morals of a |
| http://www.cs.com/fighteer |spoiled child."    - Lazarus Long     |
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019