Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!asuvax!ukma!dftsrv!mimsy!oasys!roth From: roth@oasys.dt.navy.mil (Pete Roth) Newsgroups: comp.lang.pascal Subject: TP Scope violation bug Message-ID: <7232@oasys.dt.navy.mil> Date: 22 Apr 91 13:52:18 GMT Reply-To: roth@oasys.dt.navy.mil (Pete Roth) Organization: David Taylor Research Center, Bethesda, MD Lines: 26 { The enclosed program shows that Turbo Pascal 6.0 violates the scope rules of Pascal by allowing the compilation and incorrect execution of the program. Giving wrong answers, of course. It looks to me like the table of function identifiers is not searched when variable identifiers are "compiled." } PROGRAM aBug ; (* demonstrates the violation of scope rules *) FUNCTION x : LONGINT ; VAR x : REAL ; BEGIN x := Trunc( 1.0 ) END ; BEGIN WriteLn( 'output: ', x ) END. - - - - - - - - - - - - - - - - - - - - - - - - - - Peter N Roth roth@oasys.dt.navy.mil Objects in this office are closer than they appear.