delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/08/16:31:50

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: how do i define structures ?
Date: Tue, 08 Sep 1998 13:07:46 -0700
Organization: Alcyone Systems
Lines: 22
Message-ID: <35F58E92.6FA59943@alcyone.com>
References: <35EFEEF9 DOT F9BF8861 AT gmx DOT net> <35F051A6 DOT D09CB609 AT unb DOT ca>
NNTP-Posting-Host: charmaine.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Endlisnis wrote:

>         You do have to malloc the required space, but if you want to
> return a struct,
> then just do it!

Note that passing structures by value, rather than by reference (either
through pointers or C++ references) means that the entire struct is
being pushed onto and popped off of the stack.  This can be very
expensive, and potentially damaging, if all of a structure's members
(such as pointers to data, etc.) aren't self-contained; you can get
situations where you have two structure's with inconsistent states using
overlapping memory that are not taking into account the other.

-- 
Erik Max Francis / email max AT alcyone DOT com / whois mf303 / icq 16063900 
Alcyone Systems / irc maxxon (efnet) / finger max AT sade DOT alcyone DOT com
  San Jose, CA / languages En, Eo / web http://www.alcyone.com/max/
          USA / icbm 37 20 07 N 121 53 38 W / &tSftDotIotE
             \
            / Many things are lost for want of asking.
           / (an English proverb)

- Raw text -


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