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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e1f05860a49d6f4e X-Google-Attributes: gid103376,public From: dale@cs.rmit.edu.au (Dale Stanbrough) Subject: Re: Preprocessing Ada Date: 1999/05/26 Message-ID: #1/1 X-Deja-AN: 482150563 References: <374B3689.33FF57B4@aasaa.ofe.org> X-Complaints-To: abuse@cs.rmit.edu.au X-Trace: emu.cs.rmit.edu.au 927686336 6072 144.205.16.58 (26 May 1999 02:38:56 GMT) Organization: RMIT NNTP-Posting-Date: 26 May 1999 02:38:56 GMT Newsgroups: comp.lang.ada Date: 1999-05-26T02:38:56+00:00 List-Id: David Starner wrote: " I'm writing a library in Ada and I've hit a couple things where I would use #ifdef's in C. I would like to offer alternate algorithims for the same function that can be chosen at compile time." Use different packages and use package renames... package Fast_Algorithms is... package Small_Alogrithms is... package Chosen_Package renames Fast_Algorithms; Alternatively get your sccs to select the appropriate package, and have two different versions of the same named package. I would also like to > add an expensive verification call to the front of each function that > can be turned on and off at compile time (expensive enough that I want > it to be seperate from Pragma Assert.) package Verification_Control is Do_Verification : constant Boolean := true; -- or false! procedure Verify (Item : boolean; Message : String); pragma Inline (Verify); end; package body... procedure Verify (...) is begin if Do_Verification then... end; end; Even a 1/2 sensible compiler should be able to eliminate calls to the routine, I would guess that they can completely eliminate this routine. > 2. Will cpp (the C pre-processor) work cleanly with Ada? no, it gets caught on attributes (the single ') i believe. " 3. Is there a DFSG-free preprocessor for Ada? (I hate to go this way, because that means that everyone who compiles the program needs a special preprocessor.)" ACT supply a preprocessor that works with Ada. See the documentation for details. Dale