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,a9f89faeb8f41ad0 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: ifdef replacement for GNAT Date: 1998/04/10 Message-ID: #1/1 X-Deja-AN: 342953563 References: <352287EE.1CFB@tolstoy.mdc.com> <352B8208.41C6@tolstoy.mdc.com> <86g1jm2gcf.fsf@zappa> X-Complaints-To: usenet@news.nyu.edu X-Trace: news.nyu.edu 892262068 14880 (None) 128.122.140.58 Organization: New York University Newsgroups: comp.lang.ada Date: 1998-04-10T00:00:00+00:00 List-Id: Dirk asks <> The Steelman requirements prohibited the inclusion of preprocessing in the Ada language, which may surprise you. What may surprise you more is that I and many others think this is a *good thing*. We provide gnatprep for our users, but we do NOT use it ourselves in the GNAT system. The proper approach for achieving target dependence is to follow two steps (a) encapsulte the target dependence down to the minimum level (b) Provide separate target dependent units for these remaining functions This has worked well in the GNAT project. We do use some conditional compilation in the small parts of the runtime written in C (probably conditions are overused here ...) Indeed, the use of conditional compilation has many disadvantages: 1. It tends to run amok. People throw in #ifdef's without a moment's thought about how to make the code more common, and avoid the need for target dependent conditionalization. 2. Since deleted code is not syntax or semantic checked, you don't even know that your code will compile correctly for different combinations of checks. By avoiding the inclusion of preprocessing facilities in the language, you discourage their use. This discouragement is definitely a good thing. Yes, people used to C find this surprising, but I have worked on several large Ada systems that managed just fine in dealing with target dependencies without resorting to conditional compilation. Going back to GNAT, the front end is almost entirely target independent. The backend is much more target independent than you might suppose. The great majority of target dependence is encapsulated in the configuration file, there is one such file for each target. The runtime is mostly target dependent, with the exception of five files that provide the low level tasking interface. These files have multiple versions for different targets.