Why pass structs? (not struct pointers)
ed360463 at cisunx.UUCP
ed360463 at cisunx.UUCP
Fri Feb 27 14:35:17 AEST 1987
I have been aware of the post V7 C compilers passing and
returning structs from procedures, and I am curious as to
why.
Passing structures as a whole seems to violate my impression
of the nature of C. I feel that a good reason for passing
arrays by reference (yes, I know that the pointer is passed by
value :-) is to save an enormous ammount of stack and CPU time.
To pass a structure by value seems to require an arbitrarily
large amount of stack; but more importantly, non-atomic
stack operations. That is, that I can push a long, int, char
or any pointer with (hopefully) one machine-op. To pass
a structure would require a number of pushes, a block-copy-op,
or some looping copy code.
I imagine that the people who added this to C had good reason,
so could someone please tell me what I am missing or have
gotten wrong?
Thank you
--
matt wartell
university of pittsburgh
{the known world}!pitt!cisunx!ed360463
More information about the Comp.lang.c
mailing list