This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16375] typeof() in class definition
- From: "nowak at xpam dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jul 2004 00:09:58 -0000
- Subject: [Bug c++/16375] typeof() in class definition
- References: <20040705205311.16375.nowak@xpam.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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