The information in this article applies to:
SYMPTOMSIf new is called to allocate an array whose size is determined by a variable that has a value of zero (0), the program terminates with the following message in a debug build: The <line> value depends on the version of MFC that you have:
RESOLUTION
This behavior changed with the introduction of Visual C++ version 2.0. In
the MFC that shipped with version 2.0, a TRACE is output to the Debug
Window in Debug mode.
STATUSThis behavior is by design. It is intended to help programmers detect logic errors in programs. MORE INFORMATIONThe run-time operator new() can be called with the argument zero. A distinct (non-null) pointer to an object will be returned. (See Section 5.3.3, third paragraph of the ARM - M.A.Ellis, B.Stroustrup.) This is the behavior of Visual C++ versions 2.x and 4.0. However, Visual C++ version 4.0 does not warn when new() is called with a zero size. It is the programmer's responsibility to ensure the pointer returned by new() is of the appropriate size. Sample Code
Additional query words: 1.00 1.50 2.00 2.10 2.50 2.51
Keywords : kbnokeyword kbMFC kbVC |
Last Reviewed: February 2, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |