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, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!uunet!husc6!think!ames!ncar!noao!nud!mcdchg!clyde!rjs@moss.ATT.COM From: rjs@moss.ATT.COM Newsgroups: comp.lang.ada Subject: Re: Conditional compilation Message-ID: <28255@clyde.ATT.COM> Date: 17 Jun 88 14:48:27 GMT References: <909*haug@vax.runit.unit.uninett> Sender: nuucp@clyde.ATT.COM Reply-To: rjs@moss.UUCP (Robert Snyder) Organization: AT&T Bell Laboratories, Whippany NJ List-Id: In article <909*haug@vax.runit.unit.uninett> haug%vax.runit.unit.uninett@TOR.NTA.NO (Steinar Haug) asks: >I'm developing programs for both DEC VAX (VAX/VMS Ada compiler) and >SUN-3 (Alsys Ada compiler). I need to use some form of conditional >compilation. > >The LRM contains a reference [10.6] to conditional compilation but >it seems rather cryptic and it is not obvious to me how I could use >it in practice. > This seems to be the type of mechansim that 10.6 is referring to: -- At the beginning of your source, or in a separate package that you -- include in any module that needs to conditionally compile based on -- the target, make the following declarations. type MACHINE_NAME is (VAX, SUN3); TARGET : constant MACHINE_NAME := VAX; -- Change this line to compile -- for a different target -- Then wherever you need to conditionally compile code based on the -- target machine, use the following: case TARGET is when VAX => -- VAX specific code goes here. when SUN3 => -- SUN-3 specific code goes here. end case; Of course this solution assumes that you can put all your conditional stuff in a case statement. The compiler is allowed to not generate any of the code for the obviously FALSE case. Good Luck. Robert Snyder {ihnp4|clyde}!moss!rjs (201) 386-4467 The above statements are my own thoughts and observations and are not intended to represent my employer's position on the subject(s).