comp.lang.ada
 help / color / mirror / Atom feed
From: stt@houdini.camb.inmet.com (Tucker Taft)
Subject: Re: Storage space question
Date: 1998/12/10
Date: 1998-12-10T00:00:00+00:00	[thread overview]
Message-ID: <F3ruDu.Cr1.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: 36704ADB.73FA308D@pwfl.com

Marin David Condic (condicma@bogon.pwfl.com) wrote:

: ...
: If you can't find an answer in the compiler-specific documentation, you
: can always get there through the
: less-desirable-but-no-worse-than-C-does-it method of declaring a bunch
: of named numbers:

: Some_Name : constant := 2#0101# ;

: It does, as you observe, have name-space problems, but it will get you
: there. 

Actually, rather than using named numbers, I would recommend
using named constants of a derived integer type devoted to this
particular machine register.  This way, you would at least 
get some type checking when you have more than one such machine
register.

E.g.:
   type DMA_Register_Command is range 0..2#1111#;
   
   Start_DMA_Transfer : constant DMA_Register_Command := 2#0101#;
   ... 

Personally, I would only use enumerations for things which are
clearly enumerable.  Machine registers often use combinations of
bits, which are easily done with "+" for integers (or with "or"
in Ada 95 on modular types), but not easily done with enumeration types.

: MDC
: -- 
: 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
: ***To reply, remove "bogon" from the domain name.***

--
-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Burlington, MA  USA
An AverStar Company




  reply	other threads:[~1998-12-10  0:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-10  0:00 Storage space question Craig Allen
1998-12-10  0:00 ` Marin David Condic
1998-12-10  0:00   ` Matthew Heaney
1998-12-10  0:00     ` dennison
1998-12-10  0:00   ` Pat Rogers
1998-12-10  0:00     ` dennison
1998-12-10  0:00       ` Pat Rogers
1998-12-10  0:00   ` Tucker Taft
1998-12-10  0:00     ` callen
1998-12-10  0:00       ` Marin David Condic
1998-12-10  0:00         ` Tucker Taft [this message]
1998-12-11  0:00           ` dennison
1998-12-11  0:00         ` Matthew Heaney
1998-12-11  0:00           ` Marin David Condic
1998-12-12  0:00             ` Matthew Heaney
1998-12-12  0:00               ` David C. Hoos, Sr.
1998-12-12  0:00                 ` Matthew Heaney
1998-12-14  0:00                 ` dennison
1998-12-10  0:00       ` dennison
1998-12-11  0:00       ` Matthew Heaney
1998-12-10  0:00 ` dennison
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox