Two variables for the price of one
Dave Astels
880716a at aucs.uucp
Wed Aug 29 02:08:31 AEST 1990
In article <1990Aug26.144403.17638 at batcomputer.tn.cornell.edu> cchase at 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 at AcadiaU.CA
PO Box 835, Wolfville, | Bitnet: 880716a at Acadia
More information about the Comp.lang.c
mailing list