ID Number: Q64565
6.00 6.00a 6.00ax | 6.00 6.00a
MS-DOS | OS/2
buglist6.00 buglist6.00a buglist6.00ax fixlist7.00
Summary:
SYMPTOMS
In Microsoft C versions 6.0, 6.0a, and 6.0ax, and in the Microsoft
QuickC Compiler version 2.5 or 2.51, the #if compiler directive
uses only the lower 2 bytes of the evaluated expression when
testing for true or false.
RESOLUTION
The workaround for this problem is to only use 2-byte expressions
in an #if directive.
STATUS
Microsoft has confirmed this to be a problem in C versions 6.0,
6.0a, and 6.0ax and QuickC versions 2.5 and 2.51 (buglist2.50 and
buglist2.51). This problem was corrected in C/C++ version 7.0.
More Information:
The following code will evaluate the #if expression to false, when it
should evaluate to true because the number is nonzero:
Sample Code
-----------
/* Compile options needed: none
*/
void main (void)
{
#if 0xFFFF0000L
printf("TRUE\n");
#else
printf("FALSE\n");
#endif
}
According to the ANSI standard (Section 3.8.1), any long expression in
an #if directive must be evaluated as if it were a long value.
Additional reference words: 6.00 6.00a 6.00ax 2.50