delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/07/12:29:25

From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Calling assembly procedures from DJGPP
Date: 7 Aug 1997 06:10:29 GMT
Organization: The National Capital FreeNet
Lines: 28
Message-ID: <5sbosl$j3r@freenet-news.carleton.ca>
References: <199708050149 DOT LAA20334 AT wumpus DOT its DOT uow DOT edu DOT au> <qSzpQDAf635zEwJ3 AT talula DOT demon DOT co DOT uk>
Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
NNTP-Posting-Host: freenet3.carleton.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


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