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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,68038c52a7413447 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-13 06:30:03 PST Path: archiver1.google.com!news1.google.com!news.glorb.com!newsfeed3.easynews.com!easynews.com!easynews!border1.nntp.sjc.giganews.com!nntp.giganews.com!local1.nntp.sjc.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 13 Apr 2004 08:29:59 -0500 Date: Tue, 13 Apr 2004 09:29:58 -0400 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Enum or Named Number References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.90.114 X-Trace: sv3-VIw6DiJQ+bUu+32DjBJOzQHp5gbWzfQrWjuIAzDySnYoeN7VJ5gSNv0NZTVCXu4nbA0XF0To9LhGfUk!2qG3B1xizG0If7sUKUEHZTPsFkVUn+yOLWIXgre+Ht2T8bCJuBguzGldXdTYLg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:7051 Date: 2004-04-13T09:29:58-04:00 List-Id: Jeff wrote: > Is the named number implementation the way to go, or is there a better > way? It may be, but there is a third way that is often right for such types. You define an enumeration type: type State_Index is (...State3_Index, State2_Index, State1_Index); (You may not need to reverse the order to match the C code, but it is the more common way of defining such types in C. And in that case it is much easier to have exactly 16 or 32--or whatever word size is--values.) Now you define your state type: type State is array (State_Index) of Boolean; And now you can define any subsets you need: State3: State := (State3_Index => True, others => False); This approach is very wordy in the defining package. (But what is cut and paste for?) It does give you an abstraction with the various (mathematical) set operations defined but no arithmetic operations. Of course, another way to do that is to make the type private and export only the operations you want. -- Robert I. Eachus "The terrorist enemy holds no territory, defends no population, is unconstrained by rules of warfare, and respects no law of morality. Such an enemy cannot be deterred, contained, appeased or negotiated with. It can only be destroyed--and that, ladies and gentlemen, is the business at hand." -- Dick Cheney