[quoted text, click to view] Ben Voigt [C++ MVP] wrote:
> "SvenC" <SvenC@community.nospam> wrote in message
> news:2194A33C-58E0-442C-BAD6-6C0DCA81C690@microsoft.com...
>> Hi
>>
>>> I get compile when using VS2005 but not in VS2003.
>>>
>>> The compile error is the following
>>> "Error 1 error C3867:
>>> 'MeltPracCommon::ReasonDialog::tbReason_TextChanged': function call
>>> missing argument list; use
>>> '&MeltPracCommon::ReasonDialog::tbReason_TextChanged' to create a
>>> pointer to member
>>> c:\pk\development\products\utcas\4.0\src\commoncontrol\ReasonDialog.h
>>> 110"
>>>
>>> When I click on the error it set the curson on this row."
>>> this->tbReason->TextChanged += new System::EventHandler(this,
>>> tbReason_TextChanged);"
>> I guess the compiler tells you to do this:
>>
>> this->tbReason->TextChanged += new System::EventHandler(this,
>> &MeltPracCommon::ReasonDialog::tbReason_TextChanged);
>>
>> VC2003 was not standard compliant in this area and accepted your old
>> syntax.
>
> He's compiling with /clr:oldSyntax it appears, from the function definition
> given. And there was no standard in the VC2003 days.
Ben:
I think Sven was talking about the general C++ syntax for pointer to
member function, which is not specific to .NET. VC versions prior to VC8
would allow omission of the class name, as well as the required &.
I must say I have never understood why the pointer to member function
syntax gas to be so picky (why the & is not optional, and why the class
name cannot be determined by the usual scoping rules). It seems at odds
with other things in the C++ language.
--
David Wilkinson