comp.lang.ada
 help / color / mirror / Atom feed
From: billwolf%hazel.cs.clemson.edu@hubcap.clemson.edu (William Thomas Wolfe, 2847 )
Subject: Re: "limitations" of conditional compilation
Date: 11 Dec 89 15:58:45 GMT	[thread overview]
Message-ID: <7398@hubcap.clemson.edu> (raw)
In-Reply-To: 8912110202.AA11909@mbunix.mitre.org

From emery@MBUNIX.MITRE.ORG (Emery):
> Armin points out that it is perfectly legal to do conditional
> compilation of statements based on some (constant) boolean value. [...]
> Where this approach fails, though, is in non-statements such as type
> declarations.  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    [...]
> 
> Using these ("constant type") variant records would probably make the
> program harder to read, because it wouldn't be clear to the maintainer
> if this was a variant record object (or subtype) based on some 'real
> variant) or based on some conditional compilation feature.  

   Amazingly enough, the standard SYSTEM package provides precisely
   the constant that we need to do this... it's SYSTEM.SYSTEM_NAME.

   Now are you REALLY contending that any competent maintainer is 
   going to fail to understand the following?

     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;

   The floating-point type definitions are taken from your example,
   despite the fact that they do not conform to the standard protocol
   for the naming of any additional compiler-supplied floating-point 
   subtypes (Short_Float, Long_Float, Long_Long_Float, etc.).  

   
   Bill Wolfe, wtwolfe@hubcap.clemson.edu
 

  reply	other threads:[~1989-12-11 15:58 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 ` William Thomas Wolfe, 2847  [this message]
1989-12-12 21:10   ` "limitations" of "  Sun Visualization Products
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