gcc and struct passing in function arguments?

Alan Lehotsky lehotsky@sunspot.tiac.net
Wed Jul 5 13:50:00 GMT 2000


Yes, gcc can pass and return structures by value.  It is
implementation dependent how this is accomplished and whether the
values are returned via a caller-supplied temporary.

Many compilers will return structures that are 64 bits or smaller in
the result registers (assuming that doubles are returned in a pair
of 32 bit registers).  All other compilers that I'm aware of pass a
hidden extra in-parameter that's the address of a structure temporary.

The called-function stores the results into that temporary.

-- Al


More information about the Gcc mailing list