home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / amiga / programm / 13194 < prev    next >
Encoding:
Internet Message Format  |  1992-09-08  |  1.2 KB

  1. Path: sparky!uunet!portal!cup.portal.com!Aurelius
  2. From: Aurelius@cup.portal.com (Mark Christian Barnes)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Does DICE have structure returns yet?
  5. Message-ID: <65499@cup.portal.com>
  6. Date: Tue,  8 Sep 92 18:56:50 PDT
  7. Organization: The Portal System (TM)
  8. Distribution: usa
  9. References:  <1992Sep6.145442.14771@vax5.cit.cornell.edu>
  10. Lines: 28
  11.  
  12.  Yes, DICE supports passing and returning structures by value.
  13. This is for the registered version DICE v2.06.40.
  14.  
  15.  A quick look at the assembly code reveals that an extra
  16. parameter is passed, the address of return structure, when
  17. a structure is returned by value.
  18.  
  19.  The called function does a check to see if the address passed
  20. is NULL or not. A NULL address indicates that the function
  21. return value is ignored by that particular call and no copying
  22. needs to be performed before returning, ie.:
  23.  
  24.    {
  25.      returnStruct( ... ); // returnStruct( NULL, ... )
  26.    }
  27.  
  28. versus
  29.  
  30.    {
  31.     struct s;
  32.     s = returnStruct( ... ); // returnStruct( &s, ... )
  33.    }
  34.  
  35.  
  36.  This all adds up to an optimization, but I wonder if it's
  37. not bending the C calling standards a bit...
  38.  
  39.             Regards, Aurelius@cup.portal.com
  40.