structure function returns -- how?

Tim Smith tim at ism780c.UUCP
Wed Dec 31 06:39:40 AEST 1986


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



More information about the Comp.lang.c mailing list