STATIC_DOWNCAST bug when used on const pointers?
Niels Ull Jacobsen -- nuj@kruger.dk Wednesday, May 01, 1996 VC++ 4.1, MFC 4.1, Win95 I run into an infinite recursion when using STATIC_DOWNCAST on a const= pointer. In afx.inl, line 38-41, I find:=20 #ifdef _DEBUG _AFX_INLINE const CObject* AFX_CDECL AfxStaticDownCast(CRuntimeClass* pClass, const CObject* pObject) { return (CObject*)AfxStaticDownCast(pClass, (const CObject*)pObject); } #endif This gives an endless recursion. I think it should be _AFX_INLINE const CObject* AFX_CDECL AfxStaticDownCast(CRuntimeClass* pClass, const CObject* pObject) { return (const CObject*)AfxStaticDownCast(pClass, const_castpObject); } Niels Ull Jacobsen, Kr=FCger A/S (nuj@kruger.dk) Everything stated herein is THE OFFICIAL POLICY of the entire Kruger group and should be taken as legally binding in every respect. Pigs will grow wings and fly.
Mike Blaszczak -- mikeblas@interserv.com Wednesday, May 01, 1996 On Wed, 01 May 1996, Niels Ull Jacobsenwrote: >I run into an infinite recursion when using STATIC_DOWNCAST >on a const pointer. Yep. It's been fixed for MFC 4.2. Since I fixed it, I probably broke something else at the same time. For now, you'll have to cast away constness. .B ekiM TCHAR szDisc[] = _T("These words are my own; I do not speak for Microsoft.");
| Вернуться в корень Архива |