Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!leah!itsgw!steinmetz!uunet!portal!cup.portal.com!R_Tim_Coslet From: R_Tim_Coslet@cup.portal.com Newsgroups: comp.lang.modula2 Subject: Re: Is this a compiler bug? Message-ID: <15394@cup.portal.com> Date: 4 Mar 89 23:19:28 GMT References: <1712@psu-cs.UUCP> <291@val.UUCP> Organization: The Portal System (TM) Lines: 34 In Article: <291@val.UUCP> aubrey@val.UUCP (Aubrey McIntosh) Writes: > recPtr( cardinalvariable ) ^ := expression >I still don't know why I can't dereference a pointer function type, but it >seems to be forbidden. This is forbidden, because "pointers" and "cardinals" may not be the same size and the "pointers" may not "have the same structure" as "cardinals" do. For example many 8086 implementations of pointers use a 32 bit number: the upper 16 bits contain the "segment" and the lower 16 bits contain the "address" in that "segment". The 8086 uses this to generate a 20 bit address. Pointer: ssssaaaa ssss0 aaaa ----- xxxxx = Physical memory address "casting" a cardinal to a pointer on this machine would produce garbage. A better way to do it is to implement a "machine-specific" variant record definition (with no tag variable). Then if you need to generate a "custom" pointer you assign to the fields under one name and use them under the other... trick.addr := {machine specific value(s)...} trick.val^ := expression R. Tim Coslet Usenet: R_Tim_Coslet@cup.portal.com BIX: r.tim_coslet