home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / pascal / 6824 < prev    next >
Encoding:
Internet Message Format  |  1992-11-22  |  1.2 KB

  1. Path: sparky!uunet!olivea!charnel!rat!ucselx!crash!tech
  2. From: tech@crash.cts.com (Don Bontemps)
  3. Newsgroups: comp.lang.pascal
  4. Subject: I found a compiler bug in TP6.0, maybe...
  5. Message-ID: <1992Nov22.192602.16440@crash>
  6. Date: 23 Nov 92 03:26:02 GMT
  7. Organization: CTS Network Services (crash, ctsnet), El Cajon, CA
  8. Lines: 35
  9.  
  10.  
  11. When I attempt to compile the following code, I get a runtime error 202.
  12. It appears that I am getting an array range check error but the array index
  13. is within range.  Here an example code listing:
  14.  
  15. program range_bug;
  16.  
  17.  
  18. { Author: Donald P. Bontemps Jr.
  19.     Date: November 22, 1992      }
  20.  
  21.  
  22. const
  23.  
  24.   days : array [-1..6] of string[10] = (' ','Sunday','Monday','Tuesday',
  25.                                         'Wednesday','Thursday','Friday',
  26.                                         'Saturday');
  27.  
  28.   num : word = 0;
  29.  
  30.  
  31. begin
  32.  
  33.   writeln(days[num-1]);
  34.  
  35. end.
  36.  
  37.  
  38.  
  39.  
  40. If I turn off the compiler range checking (ie: {$R-}) the program
  41. executes just fine.  The example code is a small portion of a large application
  42. that I am currently writing.  If I declare num as an integer, this fixes the
  43. error but I need num to be declared as a word.  So what gives?  Is this a
  44. bonafide compiler bug or what?  Thanks for the feedback.
  45.