The D Programming Language

John B. Nagle jbn at glacier.STANFORD.EDU
Wed Mar 9 04:10:12 AEST 1988


    If you want multiple values from functions, look at Mesa, which offers
an efficient approach.  In Mesa, all functions effectively take one argument
and return one result, but both are structures.  The normal function call
syntax is treated as a structure constructor which builds a structure out
of the arguments, then passes the structure as a unit.  The structure is usually
built on the stack, and thus this is equivalent in an implementation sense
to the passing of parameters on the stack.  In turn, a function returns a
result which is a structure.  The space for that structure is allocated by
the caller, on the stack, and its address is passed to the function, which
then fills it in.

    This approach seems to work.



More information about the Comp.lang.c mailing list