Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!yale!bunker!garys From: garys@bunker.UUCP (Gary M. Samuelson) Newsgroups: comp.lang.c Subject: Re: Question on structures Message-ID: <3022@bunker.UUCP> Date: Wed, 4-Nov-87 09:26:44 EST Article-I.D.: bunker.3022 Posted: Wed Nov 4 09:26:44 1987 Date-Received: Tue, 10-Nov-87 04:55:23 EST References: <1025@phoenix.Princeton.EDU> Reply-To: garys@bunker.UUCP (Gary M. Samuelson) Organization: Bunker Ramo, an Olivetti Company, Shelton, Ct Lines: 27 Keywords: Sturctures records In article <1025@phoenix.Princeton.EDU> asjoshi@phoenix.UUCP (Amit S. Joshi) writes: >I have gotten really tired of typing things like a.b.c.d etc to refer to >elements of a structure. I remember that pascal provided me with a 'with' >construction which allowed me to say something like > "with a.b.c {now refering to d really means use a.b.c.d } ..." >I was wondering if there is some similar contruct in C. No, there is nothing in C like Pascal's 'with'. But you can use: #define d a.b.c.d and "now referring to d really means use a.b.c.d". You have to do this with each member name you use, but that's not too bad if you have an editor which makes it easy to make several copies of the same line. Then where the end of the 'with' is, you could put #undef d Or you can use #define W(x) a.b.c.x W(d) = 1; W(e) = 2; etc. Hope this helps. Gary Samuelson AyoDu'reVweAlcNomCeE