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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,e5dc20115bb61aec X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!r42g2000yqj.googlegroups.com!not-for-mail From: okellogg Newsgroups: comp.lang.ada Subject: Re: Generalized serialization for enumeration types Date: Wed, 26 Aug 2009 04:00:52 -0700 (PDT) Organization: http://groups.google.com Message-ID: <54f0af10-4029-4209-84c4-163e3dcd56a9@r42g2000yqj.googlegroups.com> References: <249a69e5-8e21-4968-a183-64732618660a@h21g2000yqa.googlegroups.com> NNTP-Posting-Host: 80.156.47.202 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1251284453 18091 127.0.0.1 (26 Aug 2009 11:00:53 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 26 Aug 2009 11:00:53 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r42g2000yqj.googlegroups.com; posting-host=80.156.47.202; posting-account=a23u_AkAAAB-Xz81hSqodYsmJRrMwioK User-Agent: G2/1.0 X-HTTP-Via: 1.1 DEIPROXY02, 1.1 INETPROXY02 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; UL611072003NET),gzip(gfe),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:7985 Date: 2009-08-26T04:00:52-07:00 List-Id: On 26 Aug., 12:22, xorque wrote: > [...] > The encoding rules are simple: > > The enumeration values are converted to unsigned 32 bit > integers with the first value as 0 and increasing sequentially > with each new value. > [...] > Freezing rules prevented me from writing a generic > Packed_Enumeration_IO > package ("representation item appears too late"). If your enums are represented as you describe then why do you need representations? You could rely on the natural Ada representation (which happens to conform with your encoding rules as far as the enum values are concerned). --Oliver