[Qt-interest] [OT] RE: QWizardPage::wizard() overprotected?

Niels Dekker - no return address noreply at this.is.invalid
Fri Dec 12 13:45:22 CET 2008


Oliver Knoll wrote:
>>>> #define private public
>>>> #define protected public

>> I can confirm that this still works with Visual Studio 2005 (Express)

On VC++ 2008 SP1, it gets me those link errors (as mentioned by Thiago 
Macieira): error LNK2019: unresolved external symbol 
"__declspec(dllimport) public: class QWizard * __thiscall 
QWizardPage::wizard(void)const".  You don't get them, when trying to 
call QWizardPage::wizard()?  Or did you rebuild Qt after the keyword 
redefinition?

> http://everything2.com/index.pl?node_id=855268

Thanks, Oliver! There's the C++ Standard citation: "Nor shall such a 
translation unit define macros for names lexically identical to 
keywords".  The latest draft is even more specific: "A translation unit 
shall not #define or #undef names lexically identical to keywords." 
www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2800.pdf section 
17.6.4.3.2 Macro names [macro.names]


> Anyway, I got this dirty trick from some C++ guru...

He must have been mistaken (or maybe he was just joking?).  Even guru's 
can make mistakes, you know!


Kind regards, Niels




More information about the Qt-interest-old mailing list