mcnabb@uiucdcsb.cs.uiuc.edu (12/19/87)
Here's an interesting MS FORTRAN 77 compiler V2.2 behavior that confused (might one say abused?) an amazing number of my students this semester: > 00001 program STRTST > 00002 character*14 STR1, STR2 > 00003 > 00004 STR1 = 'abcdefghijklmnopqr' > 00005 C Now for erroneous use of STR1: > 00006 STR2 = STR1 (2,5) > 00007 C Some filler lines: > 00008 print *, 'STR1 = "', STR1, '"' > 00009 print *, 'STR2 = "', STR2, '"' > 00010 C Now for proper use of STR1: > 00011 STR2 = STR1 (2:5) > > ***** error in line 00011 [TR1 (2]: too many left parantheses > > 00012 > 00013 stop > 00014 end > > ***** 1 error Note that improper use (as a 2-D array) of the STR1 string variable is not flagged, and the compiler subsequently forgets that STR1 is a string. This is especially hard on beginning FORTRAN students since the point of detection may be many lines beyond of the point of the error. (BTW, would some Microsoft person on the net be so kind as to tell me what "parantheses" are? I think even one of these would be too many. :-) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Another one "good for a grin" is the beginner's DO-loop running from 1 to "10000" (yes, many beginners make this mistake): > do 99 I = 1, 10,000 > ... This one actually crashes the compiler and often takes the system out too. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Speaking of crashing the system ... One of my TAs is working on a "lint" program for FORTRAN to give students a means of finding mis-matched actual and formal argument lists. Since most of these mismatches cause MSF runtime crashes (i.e. system dies too), and some even cause compile-time crashes (ditto), such a program would be invaluable to the students. If anyone else is interested (or has already written such a beast!) please contact me by email. David McNabb Department of Computer Science University of Illinois at Urbana-Champaign USENET: ...!{cmcl2,seismo,ihnp4}!uiucdcs!mcnabb ARPA: mcnabb@a.cs.uiuc.edu