home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!gatech!paladin.american.edu!howland.reston.ans.net!spool.mu.edu!uwm.edu!cs.utexas.edu!torn!news.ccs.queensu.ca!slip203.telnet1.QueensU.CA!dmurdoch
- From: dmurdoch@mast.queensu.ca (Duncan Murdoch)
- Subject: Re: Variant records
- Message-ID: <dmurdoch.334.727822626@mast.queensu.ca>
- Lines: 20
- Sender: news@knot.ccs.queensu.ca (Netnews control)
- Organization: Queen's University
- References: <1993Jan23.140159.10176@wariat.org>
- Date: Sat, 23 Jan 1993 20:57:06 GMT
-
- In article <1993Jan23.140159.10176@wariat.org> sjsobol@wariat.org (Steven J. Sobol) writes:
- >I consider myself a pretty knowledgable Pascal programmer, but there is
- >one thing I haven't been able to figure out. When you have a variant
- >record such as the following
-
- >var Rec : record
- > case Boolean of
- > ( True: BigNumber: LongInt; )
- > ( False: ALongInt: LongInt; )
- >end;
-
- >how does the computer resolve a reference to Rec.Bignumber as opposed to
- >Rec.LongInt? Could I use an ordinal value instead of a Boolean, like this:
-
- It doesn't. Those are exactly equivalent. I'm not sure if standard Pascal
- forces you to declare a tag field (e.g. "case Choice:Boolean of ..") and
- then makes sure that your references are consistent with the value there,
- but TP certainly doesn't.
-
- Duncan Murdoch
-