home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 14 Text / 14-Text.zip / C6_BUGS.ZIP / C6_20091.BUG < prev    next >
Text File  |  1990-09-11  |  1KB  |  43 lines

  1. Q64565 #if Uses Only Lower 2 Bytes of Expression for Test
  2. Microsoft C Compiler (C)
  3. 6.00   | 6.00
  4. MS-DOS | OS/2
  5.  
  6. Summary:
  7.  
  8. The #if compiler directive uses only the lower 2 bytes of the
  9. evaluated expression when testing for true or false.
  10.  
  11. The following code, when compiled using the C 6.00 compiler, will
  12. evaluate the #if expression to false, when it should evaluate to
  13. true since the number is non-zero:
  14.  
  15. Sample Code
  16. -----------
  17.  
  18. void main (void)
  19. {
  20. #if 0xFFFF0000L
  21.   printf("TRUE\n");
  22. #else
  23.   printf("FALSE\n");
  24. #endif
  25. }
  26.  
  27. More Information:
  28.  
  29. According to the ANSI standard (Section 3.8.1), any long expression in
  30. an #if directive must be evaluated as if it were a long value.
  31.  
  32. The workaround for this problem is to only use 2-byte expressions in
  33. an #if directive.
  34.  
  35. Microsoft has confirmed this to be a problem with the Microsoft C
  36. Compiler version 6.00. We are researching this problem and will post
  37. new information here as it becomes available.
  38.  
  39. Keywords:  buglist6.00
  40.  
  41. COPYRIGHT Microsoft Corporation, 1990.
  42. Updated  90/09/01 08:26
  43.