home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!nwnexus!abyss!milton
- From: milton@abyss.wa.com (Steve Milton, Sysop)
- Newsgroups: comp.lang.pascal
- Subject: Re: I found a compiler bug in TP6.0, maybe...
- Message-ID: <JgLouB1w165w@abyss.wa.com>
- Date: Sun, 22 Nov 92 23:32:18 PST
- References: <1992Nov23.061222.3675@u.washington.edu>
- Organization: ISOMEDIA, Inc.
- Lines: 33
-
- nobby@byron.u.washington.edu (Vitaly Shmatikov) writes:
-
- > In article <1992Nov22.192602.16440@crash> tech@crash.cts.com (Don Bontemps) w
- > >
- > >When I attempt to compile the following code, I get a runtime error 202.
- [Some lines deleted.]
- > >
- > > num : word = 0;
- > >
- > >
- > >begin
- > >
- > > writeln(days[num-1]);
- > >
- > >end.
- > >
- > >
- >
- > Just a guess: when num-1 is evaluated the result is coerced to the
- > type of num, i.e. word. -1 is 2^16-1 if treated as word. Range error is
- > raised while trying to dereference days[2^16-1]. Looks like perfectly normal
- > compiler behaviour.
-
- It is even simpler than that. WORD is defined as an unsigned value.
- change num to an integer type and it may work. (I have never used
- negative values for array ranges, so I'm not sure pascal even allows
- them, but try as you like.).
-
-
- +---------------------------------------------------------------------------+
- | Stephen Milton, Sysop of `The Abyss UUCP BBS & Mail Feed' Bellevue, WA. |
- | Internet: milton@abyss.wa.com UUCP: nwnexus!abyss!milton |
- +---------------------------------------------------------------------------+
-