FIX: Function Style Conversion Incorrectly Generates Errors (115705)
The information in this article applies to:
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 4.1
- Microsoft Visual C++, 32-bit Editions 4.2
- Microsoft Visual C++, 32-bit Editions 5.0
- Microsoft Visual C++, 32-bit Editions 6.0
This article was previously published under Q115705 SYMPTOMS
When calling a class conversion function within a macro, as shown in the
code below, the compiler may incorrectly generate the following errors:
error C2061: syntax error : identifier 'timeVal'
error C2066: cast to function type is illegal
error C2059: syntax error : ')'
RESOLUTION
Following are two possible workarounds for this problem:
- Use temporary variables to hold an intermediate result.
unsigned int tmp1, tmp2;
tmp1 = WORD(timeVal);
tmp2 = WORD(dateVal);
m_dwVal = MAKELONG(tmp1, tmp2); -or-
- Use a type cast operator instead of a conversion operator.
m_dwVal = MAKELONG((WORD)timeVal, (WORD)dateVal);
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
This problem was corrected in Microsoft Visual C++ .NET.
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbBug kbCompiler kbCPPonly kbfix kbNoUpdate KB115705 kbAudDeveloper |
---|
|