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,355f90547d1b4b5 X-Google-Attributes: gid103376,public From: fraser@synopsys.com (Fraser Wilson) Subject: Re: PRECOMPILATION Date: 1999/02/10 Message-ID: <79sgbu$aod$1@remarQ.com>#1/1 X-Deja-AN: 442891395 References: <918556681.260459@dedale.pandemonium.fr> <36C0B5D4.DEF83A66@averstar.com> X-Complaints-To: newsabuse@remarQ.com X-Trace: 918668478 KZBGBQC4S164892E1C usenet87.supernews.com Organization: Vegetarian Ada Programmers Newsgroups: comp.lang.ada Date: 1999-02-10T00:00:00+00:00 List-Id: I nearly cried when stt@averstar.com said: >However, we have had good experience with making the >unit of variation be the whole source file. Typically >you can define a small number of primitive types and constants >which can isolate out the environment-specificity from all >other source files. Then you only need to select which >version of this one source file you will use to switch from >one environment to another. Our experience is that this approach >is dramatically more maintainable that spreading #ifdef's or >equivalent out all over the code. Indeed. For various reasons, I maintain a small compiler that emits assembler for either a 32 bit virtual processor that executes editor extension commands, or an 8 bit 6502 (which means that I can finally use Ada on my Commodore 64 -- actually, a C64 emulator, but close enough). To switch between targets, I put all the system dependent stuff in subdirectories of the main source tree, and use compile time flags to tell gnatmake to select the appropriate one. Voila! It's safe, and it's hard to create obscure bugs this way. This works unbelievably better that mucking around with a preprocessor. I remember those days when I used a bunch of #error directives to try to find out why a particular file, the subject of a #include, wasn't being read, and the culprit was usually some sort of #define coupled with #ifdef stuff. Pure evil. Mind you, we were using Visual C++, so we were kind of doomed from the start I think. On a side note, who wants to target GNAT to MMIX? There's some interesting features on the chip that are impossible (or very dodgy) to access from C, whereas Ada compilers can target them with ease. cheers, Fraser. -- Fraser Wilson | 700 East Middlefield Rd | Phone: 650 943 5270 Sr R&D Engineer | Mountain View, CA 94043 | Fax: 650 934 1227 Synopsys Inc | USA | Email: fraser@synopsys.com Ada, Linux, PowerPC: The Golden Triangle