comp.lang.ada
 help / color / mirror / Atom feed
From: keith@sunpix.UUCP ( Sun Visualization Products)
Subject: Re: "limitations" of conditional compilation
Date: 12 Dec 89 21:10:09 GMT	[thread overview]
Message-ID: <1032@jetcomp.UUCP> (raw)
In-Reply-To: 7398@hubcap.clemson.edu

In article <7398@hubcap.clemson.edu> billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu writes:
>From emery@MBUNIX.MITRE.ORG (Emery):
>>  It would be nice to have support for this:
>> 	type foo_bar is record
>>           x : integer;
>> #ifdef VAX
>> 	    y : float_64;
>> #elsif IBM_PC_WITH_8087    [...]
>   Amazingly enough, the standard SYSTEM package provides precisely
>     type foo_bar (MACHINE : SYSTEM.NAME := SYSTEM.SYSTEM_NAME) is record
>        X : Integer;
>        case MACHINE is
>           when VAX => Y : Float_64; 
>           when IBM_PC_WITH_8087 => Y : IEEE_Float;
>        end case;
>     end record;

I no longer work in an Ada shop, so I don't have a compiler or my
old copy of the interpretations to help double-check
my reading of the LRM, but according to 3.7 (3)
"The identifiers of all components of a record type must be distinct."
I interpret this to mean that the above record is illegal.

However, even if my interpretation is incorrect, I still feel that
some form of conditional compilation above and beyond "IF FALSE" is
advantageous.  At my last job, we were implementing and maintaining
an Ada compiler (written in Ada) targeted to several machines.  As
much as possible, target dependencies were localized to packages and
tables.  However, there were still occasions when a target dependent
section was best handled in a file of primarily target independent
code.   These cases did not always neatly fit into the IF TARGET=X
code scenario.  We used a preprocessor to handle these cases.  However,
if such a preprocessor were standard to Ada, then the source could
have fit better into the 'normal' Ada development environment.

  reply	other threads:[~1989-12-12 21:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-12-11  2:02 limitations on optimizers for conditional compilation Emery
1989-12-11 15:58 ` "limitations" of " William Thomas Wolfe, 2847 
1989-12-12 21:10   `  Sun Visualization Products [this message]
1989-12-13 17:33   ` Andy DeFaria
1989-12-14 20:56     ` William Thomas Wolfe, 2847 
1989-12-15 20:05   ` Andy DeFaria
1989-12-11 20:10 ` limitations on optimizers for " Robert Munck
replies disabled

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