Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!ucla-cs!khayo From: khayo@MATH.UCLA.EDU Newsgroups: comp.lang.pascal Subject: Re: Pointer problem ? Message-ID: <7404@shemp.UCLA.EDU> Date: Sat, 25-Jul-87 20:17:16 EDT Article-I.D.: shemp.7404 Posted: Sat Jul 25 20:17:16 1987 Date-Received: Sun, 26-Jul-87 03:36:14 EDT Sender: root@CS.UCLA.EDU Reply-To: khayo@MATH.UCLA.EDU (Erazm J. Behr) Organization: UCLA Math Science Department Lines: 27 =In article <254@askja.UUCP>, frisk@askja.UUCP (Fridrik Skulason) writes: = Can anyone tell me if this program fragment is supposed to compile or not. = Turbo Pascal refuses to compile it, but VAX/VMS Pascal does. = = program t; = type = p1 = ^p1; = p2 = ^p1; = p3 = ^p2; = = var p : p1; = r : p3; = begin = p := r; = end. = I somehow fail to see the problem. The statement "p1 = ^p1" is an obvious attempt at driving the compiler nuts - like saying that "zero" equals "the set consisting of zero". If your compiler doesn't protest, get it fixed (I don't know about other languages, but in Pascal this *definitely* shouldn't be allowed, the whole idea of the language being to avoid illogical tricks - whether you agree with the philosophy or not). Even if the first declaration is somehow (mis?) understood, the third one would make "r" a *handle* (or even a *pointer to a handle* {!!!}) to p1, and how can you expect p and r to be compatible is beyond me. Am I being totally fer sure stupid??? Eric