Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!ukc!kl-cs!pc From: pc@cs.keele.ac.uk (Phil Cornes) Newsgroups: comp.lang.c Subject: Re: struct accessing Message-ID: <637@kl-cs.UUCP> Date: 26 Jun 89 08:51:03 GMT References: <1545@stl.stc.co.uk> Organization: University of Keele, England Lines: 18 From article <1545@stl.stc.co.uk>, by dsr@stl.stc.co.uk (David Riches): > ......... in my dreams, I would like to have a > statement which says :- > > person = fred.$field_name$ > This sounds a nice idea but I seriously doubt that you'll find a general and portable way to do it...... The problem is that your compiler needs to be able to resolve variable references at compile time..... But the contents of your variable $field_name$ may well not be known until run time. This means that the best you can do is to write some sort of interpreter which can scan the variable and sort out its meaning at run time instead of at compile time.... And it didn't sound like this is what you were after (indeed it's what you've already got).