From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!samsung!sol.ctr.columbia.edu!emory!mephisto!mcnc!rti!sunpix!keith From: keith@sunpix.UUCP ( Sun Visualization Products) Newsgroups: comp.lang.ada Subject: Re: "limitations" of conditional compilation Summary: Conditional compilation advantageous Keywords: Ada, conditional compilation Message-ID: <1032@jetcomp.UUCP> Date: 12 Dec 89 21:10:09 GMT References: <8912110202.AA11909@mbunix.mitre.org> <7398@hubcap.clemson.edu> Reply-To: keith@jetcomp.UUCP (Keith Harp - Sun Visualization Products) Distribution: na Organization: Sun Microsystems, RTP, NC List-Id: 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.