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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ca15935e4fb21334 X-Google-Attributes: gid103376,public From: dennison@telepath.com Subject: Re: Storage space question Date: 1998/12/10 Message-ID: <74pkq0$8m9$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 420968162 References: <366FE278.FAF73497@pwfl.com> <74pfg4$3s6$1@nnrp1.dejanews.com> X-Http-Proxy: 1.0 x10.dejanews.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Thu Dec 10 23:17:22 1998 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.5 [en] (WinNT; I) Date: 1998-12-10T00:00:00+00:00 List-Id: In article <74pfg4$3s6$1@nnrp1.dejanews.com>, callen@space.honeywell.com wrote: > accomplish. I have a hardware device that has registers I will access. Lets > say one register looks like this (identifiers have been changed to protect the > innocent): > > type REGISTER_1_Type is > record > field_1_Ctrl: t_3bit; > field_2_Ctrl: t_3bit; > in the program). The reason is that I would like to make *many* of these. > For the sake of argument, say there's 100 registers each with 8 bits worth of > possibilities. I don't want tables with all that info in there, just the 100 > values that I'm using to initialize the thing to be put in the right place in If its the value of the bits themseves that are important rather that the value of the whole word (iaw: each bit has its own meaning independent of any other bits), then I'd prefer to use arrays of boolean, indexed by an enumeration. Note that the boolean operations "and", "or", and "not" will automaticly work on any array of boolean you create. Yes you still have that enumeration overhead, but now its just one string per bit, instead of 2^X strings for X bits. > Again, I'm using Ada83, and don't see a pragma that will help me. I > understand and agree with the dislike of preprocessors, but is what I'm > trying to do (which textual subst would work for...) such a bad thing to ask > for? What you can do to get a similar effect (no runtime storage) in Ada is to use named-numbers. eg: Begin_Twadling : constant := 2#10010011#; Unfortunately, this only works for Integeral types in Ada 83, and Ada 83 Integers are not really suited for this kind of use. Fortunately, most Ada 83 compilers will treat many normal constants the same as named numbers (iaw: no runtime storage) when they see that they can. This sounds like what you are asking for. Several people have pointed out that all this is easier in Ada 95. Yes there are the pragmas. Also there's a modular Integer type that you can use your named numbers with. Its a shame you can't upgrade. -- T.E.D. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own