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,d79d55198abf90d8 X-Google-Attributes: gid103376,public From: Richard Riehle Subject: Re: Conditional Compilation Date: 2000/09/19 Message-ID: <39C7CCD2.5D338DD1@ix.netcom.com>#1/1 X-Deja-AN: 671761474 Content-Transfer-Encoding: 7bit References: <7FEFA9E5E3B3C4A5.90418F4BE7D5AE58.48E094CF81EC6BD3@lp.airnews.net> X-Accept-Language: en X-Server-Date: 19 Sep 2000 20:30:05 GMT Content-Type: text/plain; charset=us-ascii Organization: MindSpring Enterprises Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-09-19T20:30:05+00:00 List-Id: Kenneth Kueny wrote: > Does ADA have an analog to the C language #define, #ifdef constructs > commonly used to include or exclude certain blocks of code in different code > versions? That is not as stupid a question as some habitues of this forum might assume. I recall a project in the late 1980's where the Ada 83 code was targeted to an embedded processor. The compiler for the intended deployment was priced very high "per seat." This was a non-DoD project with a requirement for a lot of programmers and there was a need to stay within a reasonable budget. The development manager bought a lot of copies of the Meridian compiler for the programmers and let each have a copy for his/her home computer, and installed it on MS-DOS based computers all over the lab. Then, one of the programmers wrote a little preprocessor program to detect the difference between code for the Meridian compiler and the expensive embedded system compiler. This was done with a commenting scheme in which the double hyphen, followed by some identifiers could tell the difference between the two compilation environments. The preprocessor would simply remove comments as appropriate for whichever compiler was being used. There was code in the Meridian version to emulate the features required by the embedded compiler. Programmers were encouraged to write vanilla-flavored Ada as much as possible to avoid the issues related to the embedded compiler. As is typical of such development, much of the platform-dependent code was pushed to a low level of abstraction. One result was that the programmers, encouraged to use Ada for more than just their daily work, were willing to experiment with it on their own time. More important, the developer did not have to buy as many copies of the expensive compiler, thereby reducing their overall costs. The downside was that the publisher of the embedded compiler experienced financial difficulties and is no longer able to supply Ada compilers for newer products manufactured by this organization. As far as I know, the manufacturer continues to quietly use Ada for its embedded non-Dod software products, but now provides GNAT instead of Meridian. Rational dropped the idea of updating Meridian to Ada 95 and missed an opportunity to provide a low-cost commercial Ada 95 compiler that could compete with GNAT. Preprocessors, such as the one just described, may not be in the best economic interest of the embedded compiler publishers since those publishers end up selling fewer licences. For a commercial manufacturer using Ada, this kind preprocessor may have the benefit of making the development effort a little more profitable. Richard Riehle richard@adaworks.com