comp.lang.ada
 help / color / mirror / Atom feed
From: fraser@sinopsis.com
Subject: Re: Preprocessing Ada
Date: 1999/05/26
Date: 1999-05-26T00:00:00+00:00	[thread overview]
Message-ID: <7ihfei$7s3$1@remarQ.com> (raw)
In-Reply-To: 374B3689.33FF57B4@aasaa.ofe.org

paene lacrimavi postquam David Starner <dstarner98@aasaa.ofe.org> scripsit:

>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. 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.)

>1. Is there a more 'Ada'-like way to do this?

Personally, I use packages or the 'separate' mechanism to stick the
various versions into different source files, put these source files
(OK, we're in GNAT territory now) into different directories, then
use -I to select the version I want to compile with.

Using a constant Boolean to turn on the verification check will more
than likely completely eliminate the call at compile time.

>2. Will cpp (the C pre-processor) work cleanly with Ada?

Attributes will probably cause the most obvious problems.

>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.)

If you're using GNAT, there's gnatprep, though I haven't used it myself.

cheers,
Fraser.
(change 'i's to 'y's for my real email -- sorry)




  parent reply	other threads:[~1999-05-26  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-05-25  0:00 Preprocessing Ada David Starner
1999-05-25  0:00 ` David Botton
1999-05-26  0:00 ` Marin David Condic
1999-05-26  0:00 ` fraser [this message]
1999-05-26  0:00 ` Dale Stanbrough
replies disabled

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