C.5 Pragma Discard_Names
[A
pragma
Discard_Names may be used to request a reduction in storage used for
the names of certain entities.]
Syntax
The form of a
pragma
Discard_Names is as follows:
A
pragma
Discard_Names is allowed only immediately within a
declarative_part,
immediately within a
package_specification,
or as a configuration pragma.
{configuration
pragma (Discard_Names) [partial]} {pragma,
configuration (Discard_Names) [partial]}
Legality Rules
The
local_name
(if present) shall denote a non-derived enumeration [first] subtype,
a tagged [first] subtype, or an exception. The pragma applies to the
type or exception. Without a
local_name,
the pragma applies to all such entities declared after the pragma, within
the same declarative region. Alternatively, the pragma can be used as
a configuration pragma. If the pragma applies to a type, then it applies
also to all descendants of the type.
Static Semantics
{representation pragma
(Discard_Names) [partial]} {pragma,
representation (Discard_Names) [partial]} If
a
local_name
is given, then a
pragma
Discard_Names is a representation pragma.
{
AI95-00285-01}
{
AI95-00400-01}
If the pragma applies to an enumeration type, then the semantics of the
Wide_Wide_Image and Wide_Wide_Value attributes are implementation defined
for that type[; the semantics of Image, Wide_Image, Value, and Wide_Value
are still defined in terms of Wide_Wide_Image and Wide_Wide_Value]. In
addition, the semantics of Text_IO.Enumeration_IO are implementation
defined. If the pragma applies to a tagged type, then the semantics of
the Tags.Wide_Wide_Expanded_Name function are implementation defined
for that type[; the semantics of Tags.Expanded_Name and Tags.Wide_Expanded_Name
are still defined in terms of Tags.Wide_Wide_Expanded_Name]. If the pragma
applies to an exception, then the semantics of the Exceptions.Wide_Wide_Exception_Name
function are implementation defined for that exception[; the semantics
of Exceptions.Exception_Name and Exceptions.Wide_Exception_Name are still
defined in terms of Exceptions.Wide_Wide_Exception_Name].
Implementation defined: The semantics
of pragma Discard_Names.
Ramification: The Width attribute is
still defined in terms of Image.
{
AI95-00285-01}
The semantics of S'Wide_Wide_Image and S'Wide_Wide_Value are implementation
defined for any subtype of an enumeration type to which the pragma applies.
(The pragma actually names the first subtype, of course.)
Implementation Advice
If the pragma applies to an entity, then the implementation
should reduce the amount of storage used for storing names associated
with that entity.
Implementation Advice: If
pragma
Discard_Names applies to an entity, then the amount of storage used for
storing names associated with that entity should be reduced.
Reason: A typical implementation of the
Image attribute for enumeration types is to store a table containing
the names of all the enumeration literals. Pragma Discard_Names allows
the implementation to avoid storing such a table without having to prove
that the Image attribute is never used (which can be difficult in the
presence of separate compilation).
We did not specify the semantics of the Image
attribute in the presence of this pragma because different semantics
might be desirable in different situations. In some cases, it might make
sense to use the Image attribute to print out a useful value that can
be used to identify the entity given information in compiler-generated
listings. In other cases, it might make sense to get an error at compile
time or at run time. In cases where memory is plentiful, the simplest
implementation makes sense: ignore the pragma. Implementations that are
capable of avoiding the extra storage in cases where the Image attribute
is never used might also wish to ignore the pragma.
The same applies to the Tags.Expanded_Name and
Exceptions.Exception_Name functions.
Wording Changes from Ada 95
{
AI95-00285-01}
{
AI95-00400-01}
Updated the wording to reflect that the double wide image and value functions
are now the master versions that the others are defined from.