Re: VC BUG by Igor
Igor
Fri Oct 26 05:27:13 PDT 2007
"Bob" <libo@strongwish.com> wrote in message
news:uGFjDR5FIHA.3400@TK2MSFTNGP03.phx.gbl
> The code has problem, but comiplie ok! link ok
>
> void CMyDialog::OnOK()
> {
> extern CButton m_DLG1_IDOK_n; //m_DLG1_IDOK_n not exist
> CButton m_DLG1_IDOK;
>
> if(m_DLG1_IDOK_n.GetCheck == m_DLG1_IDOK.GetCheck) // Call function
> without (), like vb
> return;
>
> CDialog::OnOK();
> }
Yes, looks like a bug. Almost fixed in VC7.1, fully fixed in VC8. The
code shouldn't compile. Consider:
struct X {
int f() {return 1;}
};
int main()
{
X x1;
X x2;
return (x1.f == x2.f);
}
This compiles in VC6 but not VC7.1. Looking at disassembly, x1.f is
treated as &X::f. The function is not actually called.
VC7.1 produces an error for the example above, but successfully compiles
this:
struct X {
int f() {return 1;}
};
int main()
{
X x;
x.f;
return 0;
}
It does however produce a warning: warning C4551: function call missing
argument list. VC8 reports an error on both examples.
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925