Section 17.6 - Other Ada Capabilities
Here are some other Ada capabilities that we haven't covered so far
but which you may be interested in:
- Ada 95 also provides a
"modular"
type, which is an integer that varies
from zero up to some integer modulus-1.
Unlike a normal integer, if you add or subtract a value and the result
doesn't fit, the result wraps around.
For example, a modulus 4 value can have the values 0, 1, 2, and 3.
If you added one to 3, you'd get 0 (due to wrapping around).
Modular types don't need to be powers of two, but if they are the
Ada compiler will select especially efficient operations to implement them.
Bit manipulation operations, such as and and or can
be used on modular types.
- Ada provides a
"fixed
point" type; these are basically integers that
the Ada compiler will automatically scale so that they can be used
as though they were floating point numbers.
This combines the exactness and speed of integers
(which on many machines are faster than Floats)
with the convenience of floating point numbers.
- Ada 95 has a number of predefined mathematical operations, including
a
random number generator,
trigonometric
and logarithmic operations, and
complex
numbers.
- Ada 95 has a number of predefined
Character
handling subprograms (to upper case, to lower case, etc) and
string
mapping subprograms (to create sets of characters for translation
and word edge detection).
- Normally Ada only permits access values to reference information allocated
by the new operator.
As discussed in lesson 12, you can create a general access types
that can access any value of the given type.
Such a type can access anything of that value, as long as it is marked
as aliased.
You can even alias local variables, which in many cases is dangerous.
Ada includes a set of accessibility rules that protect against
dangerous uses, which can be overridden if necessary.
This is explained with some examples in the
Ada
Rationale, part I, section II.6.
- Ada 95 compilers that support the information systems annex (annex F)
also support
packed
decimal types, a type needed for many business
programming problems.
There is no quiz question for this section.
You may go to the next section.
You may also:
David A. Wheeler (dwheeler@ida.org)