Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!mintaka!ogicse!emory!gatech!prism!gt4512c From: gt4512c@prism.gatech.EDU (BRADBERRY,JOHN L) Newsgroups: comp.lang.fortran Subject: Re: Is this kosher? Message-ID: <20773@hydra.gatech.EDU> Date: 30 Jan 91 12:12:44 GMT References: <2787@dftsrv.gsfc.nasa.gov> Organization: Georgia Institute of Technology Lines: 38 In article <2787@dftsrv.gsfc.nasa.gov> jim@jagubox.gsfc.nasa.gov (Jim Jagielski) writes: > >Tell me, is jumping into an IF block statement legal (I know it ain't >pretty)... for example: The program fragment suggested produces the following output (modified and using a Microsoft 5xx Compiler): 15 16 if (value .lt. 0) then 17 COUNT=12345 18 else 19 22 COUNT=0 20 end if 21 22 if (a.lt.b) goto 22 ***** XXX.FTN(22) : warning F4801: label 22 : used across blocks 23 In general, this is NOT considered good programming practice and usually leads to code that is difficult to maintain and modify. To quote Michael Metcalf (c) 1985-88, author of "Effective Fortran 77", Oxford University Press (page 44), "The statements within an IF block may be labelled, but the labels must never be referenced in such a fashion as to pass control into the range of an IF block or ELSE clause ..." When faced with an urge to do something like this, take a deep breath, get a beverage, and RE-THINK your logic. The next person to 'fix' your code will thank you! -- John L. Bradberry |Georgia Tech Research Inst|001100110011001100110011 Scientific Concepts Inc. |Microwaves and Antenna Lab|Int : gt4512c@prism 2359 Windy Hill Rd. 201-J|404 528-5325 (GTRI) |GTRI:jbrad@msd.gatech. Marietta, Ga. 30067 |404 438-4181 (SCI) |'...is this thing on..?'