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

  1. Q65302 Warning C4056: "Overflow in Constant Arithmetic" May Be Wrong
  2. Microsoft C Compiler (C)
  3. 6.00   | 6.00
  4. MS-DOS | OS/2
  5.  
  6. Summary:
  7.  
  8. The compiler warning "C4056: Overflow in constant arithmetic" can be
  9. generated by the C 6.00 compiler erroneously. This message is
  10. generated on warning level 2 or higher. If the Quick Compiler (/qc) is
  11. used, the error does not occur.
  12.  
  13. Sample Code
  14. -----------
  15.  
  16. // This code fragment will generate the C4056 error on the
  17. // the two lines that reference rate_file.factor14[8][ctr]
  18.  
  19. #include <string.h>
  20.  
  21. struct PC_RATE_FILE
  22. {
  23.   char  kind[3];
  24.   char  state[3];
  25.   char  rate_date[7];
  26.   long  base[20];
  27.   long  factor01[40][20];
  28.   long  factor02[40][20];
  29.   long  factor03[40][20];
  30.   long  factor04[40][20];
  31.   long  factor07[40][20];
  32.   long  factor08[40][20];
  33.   long  factor09[40][20];
  34.   long  factor10[40][20];
  35.   long  factor11[40][20];
  36.   long  factor12[40][20];
  37.   char  factor14[40][20][8];
  38.   long  factor15[40][20];
  39.   char  valid_year[15][3];
  40.   char  valid_terr[40][3];
  41.   char  valid_class[40][3];
  42. } rate_file;
  43.  
  44. int testit()
  45. {
  46.   long ctr;
  47.   char test_string[80],*ptr;
  48.   long test_rel;
  49.  
  50.   for (ctr=0;ctr<6;ctr++)
  51.   {
  52.     ptr = (char *)rate_file.factor14[8][ctr];
  53.     strcpy (test_string,rate_file.factor14[8][ctr]);
  54.     test_rel = rate_file.factor15[7][ctr];
  55.   }
  56.  
  57.   return(1);
  58. }
  59.  
  60. Microsoft has confirmed this to be a problem with C version 6.00. We
  61. are researching this problem and will post new information here as it
  62. becomes available.
  63. /*
  64. /* MSINTERNAL:
  65. /* Filtered by: bryant
  66. /*
  67. /* BUG INFO - Not raided due to several similar bugs in the database.
  68.  
  69. Keywords:  buglist6.00
  70.  
  71. COPYRIGHT Microsoft Corporation, 1990.
  72. Updated  90/09/01 08:26
  73.