Path: utzoo!mnetor!uunet!mcvax!ukc!mupsy!liv-cs!sqkeith From: sqkeith@csvax.liv.ac.uk Newsgroups: comp.lang.pascal Subject: Re: Global variables Message-ID: <277@csvax.liv.ac.uk> Date: 13 Apr 88 19:32:34 GMT References: <12654@brl-adm.ARPA> <529@taux01.UUCP> <4770@aw.sei.cmu.edu> Lines: 30 Organisation: Computer Science CSVAX (VAX1), Liverpool University In article <4770@aw.sei.cmu.edu>, firth@sei.cmu.edu (Robert Firth) writes: > > I don't think that's right. For example, in Pascal, an explicit > pointer (^Thing) cannot point anywhere except into the heap, ie > at an object created by NEW. It cannot alias any global variable. > > That leaves only VAR parameters as potential aliases. Even here, > a VAR parameter of one type (VAR p: ThingA) cannot alias a global > variable of any other type (VAR g: ThingB). Ah, but most Pascal compilers encourage filthy habits such as var p : ^integer; x : integer; begin p := @x; { or p := address(x); in VAX/VMS pascal } Admitedly, one doesn't have to use this and decent compilers such as VAX/VMS Pascal invent an extra layer of type compatibility rules insisting that x be declared as a [volatile] integer. Keith PS. I can't kick the above habit - I'm a part-time systems programmer! +-----------------------------------------------------------------------------+ | Keith Halewood, Janet: sqkeith@csvax.liv.ac.uk | | UUCP: ...!mcvax!ukc!mupsy!liv-cs!sqkeith | | Internet: sqkeith%csvax.liv.ac.uk@cunyvm.cuny.edu | +-----------------------------------------------------------------------------+