Path: utzoo!attcan!uunet!cs.dal.ca!aucs!880716a From: 880716a@aucs.uucp (Dave Astels) Newsgroups: comp.lang.c Subject: Re: Two variables for the price of one Keywords: C Preprocessor Message-ID: <1990Aug28.160831.26512@aucs.uucp> Date: 28 Aug 90 16:08:31 GMT References: <1990Aug26.144403.17638@batcomputer.tn.cornell.edu> Reply-To: 880716a@aucs.UUCP (Dave Astels) Organization: School of Computer Science, Acadia Univ., Nova Scotia Lines: 26 In article <1990Aug26.144403.17638@batcomputer.tn.cornell.edu> cchase@ee.cornell.edu (Craig M. Chase) writes: >So... my question is, does anybody know any neat tricks in the >C preprocessor to define a single name that will work with both >registers. > >Any suggestions? Yes. Switch to C++ and encapsulate it in a class. class FancyReg { private: RegType rega, regb; public: // standard ctors & dtors ... RegType operator = (RegType new_val) { return rega = regb = newval; } RegType operator () () { return rega; } } ... or something like that ... -- "I liked him better before he died" - McCoy, ST V =============================================================================== Dave Astels | Internet: 880716a@AcadiaU.CA PO Box 835, Wolfville, | Bitnet: 880716a@Acadia