Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!hao!oddjob!gargoyle!ihnp4!ihlpa!normt From: normt@ihlpa.ATT.COM (N. R Tiedemann) Newsgroups: comp.lang.fortran Subject: Re: "Interesting" error interpretation by f77. Message-ID: <5551@ihlpa.ATT.COM> Date: Fri, 18-Sep-87 08:30:46 EDT Article-I.D.: ihlpa.5551 Posted: Fri Sep 18 08:30:46 1987 Date-Received: Sun, 20-Sep-87 01:57:32 EDT References: <5117@jade.BERKELEY.EDU> Organization: AT&T Bell Laboratories - Naperville, Illinois Lines: 38 Keywords: FORTRAN parsing, error interpretation. In article <5117@jade.BERKELEY.EDU>, lagache@violet.berkeley.edu (Edouard Lagache) writes: > > PROGRAM PRACT > ... > READ(*,*) NUM1, NUM2 > SUM = NUM1 + NUM2 > ... > > Error on line 4 of practice.f: syntax error > Warning on line 9 of practice.f: local variable num2 never used > Warning on line 9 of practice.f: local variable read never used > ----------------------------------------------> ???? <--------- > After some discussion with the staff, we concluded that > the assignment was being interpreted before the I/O statement, > but that doesn't give me much satisfaction. > Edouard Lagache > lagache@violet.berkeley.edu Yes, that is the case, Since the two lines where combined with the S acting as a continuation character. The F77 compiler (and others) will scan a line looking for assignment statements first, if none found, then it will search for key words. This gives you the ability to use such words as read, write, etc. as variable names without compiler confusion. When compiler gives syntax error, other error messages are irrelevant. (Old Saying). This is true in Fortran, but boy is it true in any structured language. With a syntax error in C strange messages will appear 100's of lines later. Norm Tiedemann AT&T Bell Labs ihnp4!ihlpa!normt Naperville, IL 60566 "Just because we invented the stuff, doesn't mean we have to like it."