Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sdd.hp.com!apollo!beierl_c From: beierl_c@apollo.HP.COM (Christopher Beierl) Newsgroups: comp.sys.apollo Subject: Re: The wonderful Pascal compilier... Message-ID: <4e01079e.20b6d@apollo.HP.COM> Date: 14 Nov 90 15:56:00 GMT References: <43023@cci632.UUCP> Sender: root@apollo.HP.COM Reply-To: beierl_c@apollo.HP.COM (Christopher Beierl) Organization: Apollo Computer, Chelmsford, MA Lines: 27 In article <43023@cci632.UUCP> mth@cci.com (Michael Hickman) writes: > ... The program compiled fine, >but when I ran it, it barfed with an 'reference to illegal address (OS/MST >manager)' on this: > > while not((this_net = nil) or > ((this_net^.plusminus = net.plusminus) and > (this_net^.net_name = net.net_name))) do > >Looks like it tried evaluating the expression after the 'or' when the pointer >was nil. I changed it to this: > > while ((this_net <> nil) and > not((this_net^.plusminus = net.plusminus) and > (this_net^.net_name = net.net_name))) do > Pascal does NOT guarantee short-circuit evaluation of Boolean expression in an IF statement as C does. You MUST use the second form at all times to avoid the possibility of attempted to dereference a nil pointer. See "Domain Pascal Language Reference", Chapter 4 "Code", p4-93 which talks about the IF statement. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Christopher T. Beierl Internet: beierl_c@apollo.HP.COM;beierl_c@apollo.com Apollo Computer, Inc. UUCP: {mit-eddie,yale,uw-beaver}!apollo!beierl_c A Subsidiary of Hewlett-Packard Phone: (508) 256-6600