FIX: C2466: Using New to Allocate an Array of Size Zero
Article ID: 123811
Article Last Modified on 7/5/2005
APPLIES TO
- Microsoft C++ 32-bit Compiler 1.0
- Microsoft C/C++ Professional Development System 7.0
- Microsoft Visual C++ 1.0 Professional Edition
- Microsoft Visual C++ 1.5 Professional Edition
- Microsoft Visual C++ 1.51
This article was previously published under Q123811
SYMPTOMS
If a constant expression that evaluates to zero is used to allocate an
array, the following error occurs:
error C2466: cannot allocate an array of constant size 0
RESOLUTION
To work around the problem, use a variable that is initialized to
zero in place of the constant when allocating the array.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. This bug was corrected in Visual C++,
32-bit Edition, version 2.0.
Additional query words: 1.00 1.50 7.00 8.00 8.00c
Keywords: kbbug kbfix kbcpponly kbcompiler KB123811