Bug in MFC v4.2 CopyElements function
Steven Youngs -- steve@ncgraphics.co.uk
Tuesday, August 13, 1996
Environment: Windows NT 4.0, Visual C++ 4.2
OK, Just to stop everyone else tracking down the same bug...
The CopyElements function in MFC 4.2 has been broken. It is supposed to
copy n elements from src to dest. The current implementation ends up
making n copies of the first element of src.
>From ...\msdev\mfc\include\AFXTEMPL.H Line 76
template
inline void AFXAPI CopyElements(TYPE* pDest, const TYPE* pSrc,
int nCount)
{
ASSERT(nCount == 0 ||
AfxIsValidAddress(pDest, nCount * sizeof(TYPE)));
ASSERT(nCount == 0 ||
AfxIsValidAddress(pSrc, nCount * sizeof(TYPE)));
// default is element-copy using assignment
while (nCount--)
*pDest++ = *pSrc;
}
This should in fact be
*pDest++ = *pSrc++;
Later,
Steve.
Mike Blaszczak -- mikeblas@nwlink.com
Thursday, August 15, 1996
At 05:15 PM 8/13/96 +0100, Steven Youngs wrote:
>Environment: Windows NT 4.0, Visual C++ 4.2
>
>OK, Just to stop everyone else tracking down the same bug...
>The CopyElements function in MFC 4.2 has been broken. It is supposed to
>copy n elements from src to dest. The current implementation ends up
>making n copies of the first element of src.
This'll be fixed in MFC 4.2a.
.B ekiM
http://www.nwlink.com/~mikeblas <--- trip report central
1995 Honda VFR750F (Serial number 00050!)
1987 Yamaha FZ700 (damaged) AMA, HRC, VFROC
These words are my own: I do not speak for Microsoft.
| Вернуться в корень Архива
|