Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!lll-lcc!ames!sri-spam!sri-unix!hplabs!sdcrdcf!ism780c!tim
From: tim@ism780c.UUCP (Tim Smith)
Newsgroups: comp.lang.c
Subject: Re: structure function returns -- how?
Message-ID: <5076@ism780c.UUCP>
Date: Tue, 30-Dec-86 15:39:40 EST
Article-I.D.: ism780c.5076
Posted: Tue Dec 30 15:39:40 1986
Date-Received: Tue, 30-Dec-86 23:37:13 EST
References: <131@hcx1.UUCP> <773@maynard.BSW.COM> <7403@utzoo.UUCP> <490@aw.sei.cmu.edu.sei.cmu.edu> <326@bms-at.UUCP>
Reply-To: tim@ism780c.UUCP (Tim Smith)
Organization: Interactive Systems Corp., Santa Monica, CA
Lines: 18


If the called function does the copying, then the following can
cause problems:
        struct SpanishInquisition nobody, expected();

        nobody = expected();
        expected();

How does expected() tell these two cases apart?  If it doesn't, then
it is going to blow away something when it tries to copy back a structure
in the second call.

I suppose the compiler could note that the return value is being ignored,
and pass a pointer to some temporary place to hold the ignored return
value, but that seems kind of ugly.
-- 
Tim Smith       USENET: sdcrdcf!ism780c!tim   Compuserve: 72257,3706
                Delphi or GEnie: mnementh