Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!usc!sdd.hp.com!decwrl!bacchus.pa.dec.com!shlump.nac.dec.com!hiyall.enet.dec.com!reagan From: reagan@hiyall.enet.dec.com (John R. Reagan) Newsgroups: comp.lang.pascal Subject: Re: UNtagged variant records and JPAM Message-ID: <17209@shlump.nac.dec.com> Date: 13 Nov 90 15:08:24 GMT Sender: newsdaemon@shlump.nac.dec.com Organization: Digital Equipment Corporation Lines: 30 In article <225.273b14fa@vger.nsu.edu>, g_harrison@vger.nsu.edu writes... > >1. Although I can't find it in Wirth and Jansen (ISO STANDARD), is there >a guarantee that this will give the bit implementation of the integer? First of all J&W is not the same as the ISO 7185 unextended Pascal standard. Several things are different (procedural parameters, conformant arrays, etc.) Second, the standard does not guarantee this functionality. You have an invalid program. It tends to work for most compilers due to popular allocation schemes to save on memory and the fact that detecting the use of undefined variants is expensive to implement. Since most compilers don't check for this error (including VAX Pascal), you get lucky most of the time. The standard does not say how a compiler should allocate fields in a variant record. There are cases in VAX Pascal where variant parts do not overlap (those which contain file variables). The standard is even flexible enough for a compiler to not allocate fields that are never referenced (if it can determine such a fact). Untagged variants have much the same uses as tagged variants. They can describe "generic" records which can mutate forms (variants allocated with the NEW(p,c1,...cn) form cannot mutate) during the program execution. --- John Reagan, VAX Pascal Project Leader and X3J9 Secretary Digital Equipment Corporation reagan@hiyall.enet.dec.com Disclaimer: The opinions and statements expressed by me are not necessarily those of Digital Equipment Corporation. ---