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: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: Storage space question Date: 1998/12/10 Message-ID: #1/1 X-Deja-AN: 420844303 Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.camb.inmet.com References: <366FE278.FAF73497@pwfl.com> Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1998-12-10T00:00:00+00:00 List-Id: Marin David Condic (condicma@bogon.pwfl.com) wrote: : Craig Allen wrote: : > : > the short version of my question is this: If I'm using enumerations : > to : > define names that will represent specific bit patterns that my program : > may : > wish to use, do *all* these bit patterns allocate space? e.g. with : > this: : > : > type DCD_Mode_Type is : > (CARRIER_DETECT, SYNC_DETECT, LOW, HIGH); : > for DCD_Mode_Type'Size use 2; : > for DCD_Mode_Type use : > (CARRIER_DETECT => 2#00#, : > SYNC_DETECT => 2#01#, : > LOW => 2#10#, : > HIGH => 2#11# : > ); : > : > is space allocated for each of these definitions? : ... : If you've got a good avionics-quality, embedded target, Ada compiler, : I'd expect it to have switches/options to disable some of this storage : allocation. In Ada 95, there is a language-defined pragma "Discard_Names" designed to suppress the generation of the enumeration "image" tables (and other similar run-time string names). The pragma is described in RM95 C.5. For the above example, pragma Discard_Names(On => DCD_Mode_Type); would do the trick. Note also that by specifying the representation of the enumeration type, you run the danger of imposing additional space and time overhead due to the internal conversions between enumeration position number and integer code. In the above case, all bit patterns are used consecutively, and hopefully your compiler is clever enough to recognize this special case. However, there have been compilers which did not recognize this special case, and in any case, if you have any "holes" in the representation, the compiler will probably end up creating a table (or tables) for converting between position number and integer code. The "Ravenscar" profile, which is supported by some Ada 95 compilers, includes a restriction: pragma Restrictions(No_Enumeration_Maps); which should suppress these tables, and flag any place where a conversion between position number and integer code would be required. : Marin David Condic : Real Time & Embedded Systems, Propulsion Systems Analysis : United Technologies, Pratt & Whitney, Large Military Engines : M/S 731-95, P.O.B. 109600, West Palm Beach, FL, 33410-9600 : Ph: 561.796.8997 Fx: 561.796.4669 -- -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Burlington, MA USA An AverStar Company