BUG: Cannot Cast Double to int for Use in an Array Declarator (142493)
The information in this article applies to:
- Microsoft Visual C++, 32-bit Professional Edition 4.0
- Microsoft Visual C++, 32-bit Professional Edition 4.1
- Microsoft Visual C++, 32-bit Professional Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 4.2
- Microsoft Visual C++, 32-bit Learning Edition 4.0
- Microsoft Visual C++, 32-bit Learning Edition 4.2
- Microsoft Visual C++, 32-bit Enterprise Edition 5.0
- Microsoft Visual C++, 32-bit Professional Edition 5.0
This article was previously published under Q142493 SYMPTOMS
The compiler generates the following error when you type cast a 'const
float' or 'const double' to 'const int' in an array declarator:
error C2057: expected constant expression
RESOLUTION
To work around this problem, use a #defined double value in place of a
const double. See the "Workaround Sample Code" section for an example.
STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed
at the beginning of this article. We are researching this problem and will
post new information here in the Microsoft Knowledge Base as it becomes
available.
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbBug kbCompiler kbCPPonly KB142493 |
---|
|