home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!portal!cup.portal.com!Aurelius
- From: Aurelius@cup.portal.com (Mark Christian Barnes)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Does DICE have structure returns yet?
- Message-ID: <65499@cup.portal.com>
- Date: Tue, 8 Sep 92 18:56:50 PDT
- Organization: The Portal System (TM)
- Distribution: usa
- References: <1992Sep6.145442.14771@vax5.cit.cornell.edu>
- Lines: 28
-
- Yes, DICE supports passing and returning structures by value.
- This is for the registered version DICE v2.06.40.
-
- A quick look at the assembly code reveals that an extra
- parameter is passed, the address of return structure, when
- a structure is returned by value.
-
- The called function does a check to see if the address passed
- is NULL or not. A NULL address indicates that the function
- return value is ignored by that particular call and no copying
- needs to be performed before returning, ie.:
-
- {
- returnStruct( ... ); // returnStruct( NULL, ... )
- }
-
- versus
-
- {
- struct s;
- s = returnStruct( ... ); // returnStruct( &s, ... )
- }
-
-
- This all adds up to an optimization, but I wonder if it's
- not bending the C calling standards a bit...
-
- Regards, Aurelius@cup.portal.com
-