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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,45a9122ddf5fcf5 X-Google-Attributes: gid103376,public From: Alan Brain Subject: Re: Valid Attribute and Unchecked Conversion Date: 1996/10/08 Message-ID: <325A0E03.7049@dynamite.com.au>#1/1 X-Deja-AN: 187340841 references: content-type: text/plain; charset=us-ascii organization: @Home mime-version: 1.0 reply-to: aebrain@dynamite.com.au newsgroups: comp.lang.ada x-mailer: Mozilla 3.0 (Win16; I) Date: 1996-10-08T00:00:00+00:00 List-Id: Robert A Duff wrote: > > In article , Keith Thompson wrote: > >Are sparse enumeration types are really used all that much in real life? > > They shouldn't be, because, as you explained, they don't work. Using > sparse enums is asking for erroneousness. > > Well, it's not *quite* that bad: You can use a sparse enum for sending > data from Ada to the outside world (e.g. doing output, passing > parameters *to* an imported subprogram, unchecked converting *from* a > sparse enum, etc). But the other direction doesn't always work, and > should be avoided, IMHO. Beg to differ; many systems send 0001, 0010, 0100, 1000 for the 4 different valid states, etc. You often get it coming and going in real time apps. Even some disc controllers. So you use a base type without representation (internally), and convert to a represented derived type for output, and from a (maybe different) represented derived type for input. ---------------------- <> <> How doth the little Crocodile | Alan & Carmel Brain| xxxxx Improve his shining tail? | Canberra Australia | xxxxxHxHxxxxxx _MMMMMMMMM_MMMMMMMMM ---------------------- o OO*O^^^^O*OO o oo oo oo oo By pulling Maerklin Wagons, in 1/220 Scale