Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!saxony!dgil From: dgil@pa.reuter.COM (Dave Gillett) Newsgroups: comp.lang.c Subject: Re: ANSI C questions (parameters, structure assignment) Message-ID: <352@saxony.pa.reuter.COM> Date: 24 Aug 90 00:00:43 GMT References: <1081.26d26274@desire.wright.edu> Organization: Reuter:file Inc (A Reuter Company) Palo Alto, CA Lines: 28 In <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)? I believe that all "modern" C compilers pass structures of any size as value parameters, regardless of size. Some compilers on some hardware may pass small structures in registers and larger ones on the stack, or as a pointer to a copy, or some other mechanism, but it's still a value parameter and your code should reflect that. > 2) Are structure assignments allowed only for initializations >or can I do: >struct_thing = other_struct_thing; >struct_thing -= still_more_struct; >struct_thing *= even_more_struct; >etc... > I thought I knew the answer to there but VAX C (I know it's not 100% >ansi) barfs on question #2 type statements of the -= += etc. kind. Recall that "x -= y" is equivalent to "x = x - y". Will your VAX C let you get away with "struct_thing = struct_thing - still_more_struct"? How have you declared "struct_thing" that lets it both (a) be a structure, and (b) be in the domain of subtraction, which normally works on *numbers*??? Dave