Article View: comp.lang.oberon
Article #1307Re: (no subject)
From: Stephan Gehring
Date: Wed, 10 Apr 1996 10:31
Date: Wed, 10 Apr 1996 10:31
35 lines
1501 bytes
1501 bytes
In article <4kfra6$k1t@tuegate.tue.nl>, MWeiss <MartinW@ctrl.phys.tue.nl> wrote: >MODULE Test; > .... > >PROCEDURE Do*; > VAR x: T1; next: T0; >BEGIN > NEW(x); > x := x.next(T1); (* a TRAP is generated here *) >END Do; > >END Test. > >It seems that type-guarding the pointer x.next which happens to >have the value NIL at execution time causes the problem. Did >anybody else encounter this problem before? Yes. NEW (x) obviously initializes x.next to NIL. You cannot type-guard a pointer whose value is NIL. Therefore the trap. You must always ensure that the pointer being guarded is not NIL before guarding it, e.g. IF x.next # NIL THEN x := x.next(T1) END > >I am using Oberon/F v 1.1 for Windows. You'll find this behaviour in all (?) Oberon implementations -Stephan ------------------------------------------------------------------------------ Stephan Gehring Email: gehring@inf.ethz.ch Institute for Computer Systems Phone: +41 1 632 73 15 ETH-Zentrum FAX: +41 1 632 13 07 CH-8092 Zurich, Switzerland
Technical Details
Message-ID:
<4kg2mh$3f8@lillian.inf.ethz.ch>Path:
arc1-ca.pugleaf.net!elna.ethz.ch!not-for-mailReferences:
<4kfra6$k1t@tuegate.tue.nl>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!elna.ethz.ch!not-for-mail From: gehring@inf.ethz.ch (Stephan Gehring) Newsgroups: comp.lang.oberon Subject: Re: (no subject) Date: 10 Apr 1996 12:31:45 +0200 Organization: Dept. Informatik, Swiss Federal Institute of Technology Message-ID: <4kg2mh$3f8@lillian.inf.ethz.ch> References: <4kfra6$k1t@tuegate.tue.nl> NNTP-Posting-Host: lillian-ics.inf.ethz.ch