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,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-04-06 10:30:09 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: jeff.huter@bigfoot.com (Jeff) Newsgroups: comp.lang.ada Subject: Enum or Named Number Date: 6 Apr 2004 10:30:08 -0700 Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 143.182.124.4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1081272609 368 127.0.0.1 (6 Apr 2004 17:30:09 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 6 Apr 2004 17:30:09 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:6776 Date: 2004-04-06T10:30:08-07:00 List-Id: Looking for implementation advise. I'm writing a binding to some C code that has several defined number macros (e.g. #define Viewable 1) for states and flags. I would like to bitwise-or these numbers in Ada which leads me to believe I should define these as named mod numbers such as below: type State is mod 2**Interfaces.C.Int'Size State1 : constant State := 2#0001# State2 : constant State := 2#0010# State3 : constant State := 2#0100# Any reason to define these as an Enum with a representation clause? Seems like there would be more plumbing code. For example, I believe that I would need to write my own bitwise-or function for the Enum. Is the named number implementation the way to go, or is there a better way?