Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!cbmvax!vu-vlsi!swatsun!rice From: rice@swatsun (Dan Rice) Newsgroups: comp.lang.c Subject: Re: Writing readable code Message-ID: <1213@carthage.swatsun.UUCP> Date: Wed, 1-Jul-87 18:27:47 EDT Article-I.D.: carthage.1213 Posted: Wed Jul 1 18:27:47 1987 Date-Received: Sat, 4-Jul-87 03:30:08 EDT References: <8286@ut-sally.UUCP> <7001@alice.UUCP> <364@sol.ARPA> <1158@copper.TEK.COM> Organization: Swarthmore College, Swarthmore PA Lines: 28 Summary: Elementary C Question Here's a simple question for you. Suppose I have defined structures containing other structures, i.e., typedef struct { float x, y, z; /* Coordinates of a vector in 3-space */ } vector; typedef struct { vector o; /* Center */ float r; /* Radius */ } sphere; sphere s1, *s2; Now, say I refer to s1.o.x and s2->o.y. Does the compiler convert this into a simple address reference at compile time, or is work performed at runtime? Should I define vector center; center = s2->o; if I plan to use s2->o several times? Thanks for any help. -- - Dan Rice, Swarthmore College, Swarthmore PA 19081 ...!sun!liberty!swatsun!rice ...!seismo!bpa!swatsun!rice