home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / pascal / 8476 < prev    next >
Encoding:
Text File  |  1993-01-24  |  1.3 KB  |  32 lines

  1. Newsgroups: comp.lang.pascal
  2. 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
  3. From: dmurdoch@mast.queensu.ca (Duncan Murdoch)
  4. Subject: Re: Variant records
  5. Message-ID: <dmurdoch.334.727822626@mast.queensu.ca>
  6. Lines: 20
  7. Sender: news@knot.ccs.queensu.ca (Netnews control)
  8. Organization: Queen's University
  9. References: <1993Jan23.140159.10176@wariat.org>
  10. Date: Sat, 23 Jan 1993 20:57:06 GMT
  11.  
  12. In article <1993Jan23.140159.10176@wariat.org> sjsobol@wariat.org (Steven J. Sobol) writes:
  13. >I consider myself a pretty knowledgable Pascal programmer, but there is 
  14. >one thing I haven't been able to figure out. When you have a variant
  15. >record such as the following
  16.  
  17. >var  Rec : record
  18. >    case Boolean of
  19. >      ( True:  BigNumber: LongInt; )
  20. >      ( False: ALongInt: LongInt; )
  21. >end;
  22.  
  23. >how does the computer resolve a reference to Rec.Bignumber as opposed to
  24. >Rec.LongInt? Could I use an ordinal value instead of a Boolean, like this:
  25.  
  26. It doesn't.  Those are exactly equivalent.  I'm not sure if standard Pascal 
  27. forces you to declare a tag field (e.g. "case Choice:Boolean of ..") and
  28. then makes sure that your references are consistent with the value there, 
  29. but TP certainly doesn't.
  30.  
  31. Duncan Murdoch
  32.