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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c35edbbda4c7f58f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!stamper.news.atl.earthlink.net!newsread2.news.atl.earthlink.net.POSTED!d9c68f36!not-for-mail From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Conditional compilation in Ada? References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Wed, 17 Nov 2004 12:27:54 GMT NNTP-Posting-Host: 209.165.23.199 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.atl.earthlink.net 1100694474 209.165.23.199 (Wed, 17 Nov 2004 04:27:54 PST) NNTP-Posting-Date: Wed, 17 Nov 2004 04:27:54 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news1.google.com comp.lang.ada:6249 Date: 2004-11-17T12:27:54+00:00 List-Id: Unfortunately, there isn't any standard Ada way of dealing with conditional compilation and not a whole lot of sympathy for it with most people in the Ada crowd. (Probably because they've seen it abused so much in C programs that they'd rather not allow it into the language lest it cause Ada programs to turn into the sort of unholy mess many C programs have become.) People have mentioned gnatprep as a possible answer - which is fine so long as all you ever want to use is gnat. If you were dealing with code that needed to be made portable across two or more Ada compilers, you'd have a problem because gnatprep isn't standard across all compilers. (You could probably cobble something together though since it is open source.) You can also try pulling some information-hiding tricks and isolation of stuff down to package bodies & utilize some form of configuration management outside the bounds of Ada to get the desired effect. However that often seems to me to be a) overly complicated for occasional small problems and b) another non-standard way of dealing with the problem. If you really have large platform/compiler dependent issues, you're probably better off biting the bullet and using some kind of configuration management tools with isolation of whatever is dependent within package bodies. For the smaller-scale problems, you're stuck with only sub-optimal answers. MDC jtg wrote: > I am using Ada for many years now, but recently > I stumbled upon a problem I cannot solve: I need > some kind of conditional preprocessing, which is > commonly used in C programs: -- ====================================================================== Marin David Condic I work for: http://www.belcan.com/ My project is: http://www.jsf.mil/NSFrames.htm Send Replies To: m o d c @ a m o g c n i c . r "Power corrupts. Absolute power is kind of neat" -- John Lehman, Secretary of the Navy 1981-1987 ======================================================================