[comp.lang.ada] SYSTEM.NAME and SYSTEM.SYSTEM_NAME

dritz@ANTARES.MCS.ANL.GOV (12/16/89)

Recent discussions have analyzed the possibility of simulating some aspects of
conditional compilation by basing a case selection on the value of the
implementation-defined constant SYSTEM.SYSTEM_NAME.  These discussions have
mistakenly assumed that the implementation-defined enumeration type SYSTEM.NAME
is supposed to (or ought to) contain enumeration literals naming all the
implementations of Ada.  When these discussions started, there was a suggestion
that this type was a good candidate for standardization; more recently, there
was an expression of surprise that, in products of "at least two major compiler
vendors, with product lines spanning dozens of products," SYSTEM.NAME
enumerates "exactly one platform: the machine on which the compiler at hand
happens to run."

A careful reading of RM 13.7(3-6) will reveal that such Ada implementations are
very likely defining SYSTEM.NAME correctly, and in agreement with its intended
use.  In implementations that have cross-compilation (i.e., multiple target)
capabilities within a single compiler, different versions of the predefined
package SYSTEM--each corresponding to a different target ("alternative machine
configuration," to use the terminology of RM 13.7(3))--can be obtained by
compiling a SYSTEM_NAME pragma naming the desired version.  The enumeration
literal used in the pragma must have as its identifier one of those in the
definition of SYSTEM.NAME.  The value of SYSTEM.SYSTEM_NAME merely identifies
the implementation's "alternative machine configuration" to which the current
version of SYSTEM (with its system-dependent named numbers) corresponds.  If
the compiler does not have cross-compilation capabilities, it is appropriate
for the definition of SYSTEM.NAME to include only a single enumeration literal.

It is not surprising that attempts to use SYSTEM.NAME and SYSTEM.SYSTEM_NAME
for purposes for which they were not intended uncover a variety of difficulties.

--Ken Dritz
--Argonne National Laboratory
--dritz@mcs.anl.gov