ANSI C questions (parameters, structure assignment)

Stephen Clamage steve at taumet.com
Fri Aug 24 04:14:49 AEST 1990


demon at desire.wright.edu (Brett) writes:
>	1)	In standard C, when you pass a structure bigger than four
>longwords, is the structure passed as a value parameter, or just a pointer to
>the structure (thus making it a var parameter)?

The standard only says that the structure passing must behave AS IF it were
copied to the called function's parameter.  No conforming compiler can
generate code which allows you to modify the original structure from
within the called function.

Compiler implementors have free reign in the details of how this is
done.  Some compilers pass a pointer to the original struct, and in the
called function preamble copy the data to a local space.  Since no
programmer-written code gets executed before the copying is done, this
is allowable.
-- 

Steve Clamage, TauMetric Corp, steve at taumet.com



More information about the Comp.lang.c mailing list