From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,c469fdacc2f3302b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Dynamic Variant Record Creation Date: Tue, 16 Mar 2010 17:58:45 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls6.std.com 1268776713 18209 192.74.137.71 (16 Mar 2010 21:58:33 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 16 Mar 2010 21:58:33 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:6Jlb9RGO/Zinmi2j95dnpWT+u44= Xref: g2news2.google.com comp.lang.ada:10587 Date: 2010-03-16T17:58:45-04:00 List-Id: Warren writes: > except that the discriminant also be described somehow > as 3-bits. I'm not sure what you mean. If you're saying "I don't know how to specify the layout for discriminants", then the answer is "same as other components" -- you just put the usual "Discrim at ... range 0..2" or whatever. If you're saying "It won't fit in 3 bits because it has more than 2**3 values, then you're out of luck. >> You said you wanted efficiency. Well, this: >> >> T : Token_Type := Token_Type'Val(Character'Pos(Ch)); >> >> is unlikely to be efficient. The case statement will be better >> in that regard. > > If true, I'd like to know why. I can't see that in the compiled > code being much other than a move short. If I get time tonight, > I'll investigate it. Ah, I see I misread your code. I thought you were using 'Image and 'Value. Sorry. So you're right -- the above 'Pos and 'Val should be efficient. But I don't think it does what you want! The 'Pos of the Character '!' is not the same as the 'Pos of the Token '!'. - Bob