This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/16375] typeof() in class definition


------- Additional Comments From nowak at xpam dot de  2004-07-06 00:09 -------
I will explain why I want first case to work.
First some defines:

#define VWS(_name, _var) \
void Set##_name(\
        typeof(_var) v\
) {\
    _var = v;\
}

#define VWG(_name, _var) \
typeof(_var) Get##_name(\
) {\
    return _var;\
}

#define PVWGS(_name, _prefix) \
    VWG(_name, ##_prefix##_name) \
    VWS(_name, ##_prefix##_name)

Then you can just write:

class A {
protected:
    unsigned long long m_nSomeVariable;
public:
    PVWGS(SomeVariable, m_n);
};

instead of:

class A {
protected:
    unsigned long long m_nSomeVariable;
public:
    unsigned long long GetSomeVariagle() { return m_nSomeVariable; }
    void SetSomeVariable(unsigned long long v) { m_nSomeVariable = v; }
};

Of course you can add another argument to these macros:

PVWGS(SomeVariable, m_n, unsigned long long);

but thats just extra typing :)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16375


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]