home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!think.com!sdd.hp.com!ux1.cso.uiuc.edu!news.cso.uiuc.edu!s.psych.uiuc.edu!amead
- From: amead@s.psych.uiuc.edu (Alan Mead)
- Subject: Ok, why doesn't THIS cause an error?
- Message-ID: <C0AEH3.Hvr@news.cso.uiuc.edu>
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Organization: UIUC Department of Psychology
- Date: Sun, 3 Jan 1993 16:43:50 GMT
- Lines: 25
-
- I'm was a little amazed when I accidentally wrote the below bug. I
- cannot imagine why you are allowed to alter the counter of a for..do
- loop. I suppose it's too hard for the compiler to check?
-
- BTW, this was Turbo Pascal. And I suppose its a reason to give your
- variables (no matter how trivial) a real name...
-
- -alan mead
-
- program bug;
- var i,j,k : integer;
-
- function whatever;
- { var i,j,k:integer;} { this was the missing line }
- begin
- i := 2;
- for k := 1 to i*x do
- ...
- end;
-
- begin
- for i := 1 to TheEnd do
- whatever;
- end.
-
-