Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!uunet!mcsun!ukc!edcastle!aiai!richard From: richard@aiai.ed.ac.uk (Richard Tobin) Newsgroups: comp.lang.c Subject: Re: ANSI C questions (parameters, structure assignment) Message-ID: <3278@skye.ed.ac.uk> Date: 23 Aug 90 16:45:20 GMT References: <1081.26d26274@desire.wright.edu> Reply-To: richard@aiai.UUCP (Richard Tobin) Organization: AIAI, University of Edinburgh, Scotland Lines: 33 In article <1081.26d26274@desire.wright.edu> demon@desire.wright.edu 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)? Structures are passed by value regardless of their size. Whether this is implemented by actually putting the structure on the stack, or by passing a pointer to a copy of it, is invisible to the programmer. [Actually, it's only invisible to the *correct* programmer. I recently forgot to put "&" before the name of a structure I was passing. This made no difference on a Sun 4 (which passes the structure by putting the address in a register) and I didn't discover the error until I compiled it on a Sun 3.] > 2) Are structure assignments allowed only for initializations No. Structure assignments are fine in ANSI C. >struct_thing -= still_more_struct; >struct_thing *= even_more_struct; But I don't know what these are supposed to mean. What do you expect subtracting structures to do? -- Richard -- Richard Tobin, JANET: R.Tobin@uk.ac.ed AI Applications Institute, ARPA: R.Tobin%uk.ac.ed@nsfnet-relay.ac.uk Edinburgh University. UUCP: ...!ukc!ed.ac.uk!R.Tobin