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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d3037f71d9d26da1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-12-11 05:34:42 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!easynews.com!easynews!newshosting.com!news-xfer2.atl.newshosting.com!207.69.154.101.MISMATCH!elnk-atl-nf1!newsfeed.earthlink.net!stamper.news.atl.earthlink.net!newsread2.news.atl.earthlink.net.POSTED!d9c68f36!not-for-mail Message-ID: <3FD8726E.1000205@noplace.com> From: Marin David Condic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0 (OEM-HPQ-PRS1C03) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Preprocessor functionality equivalent ideas needed References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 11 Dec 2003 13:34:42 GMT NNTP-Posting-Host: 209.165.24.118 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.atl.earthlink.net 1071149682 209.165.24.118 (Thu, 11 Dec 2003 08:34:42 EST) NNTP-Posting-Date: Thu, 11 Dec 2003 08:34:42 EST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:3361 Date: 2003-12-11T13:34:42+00:00 List-Id: While I agree with the general concept of separate bodies for separate implementation-specific modules, I have occasionally run into situations where it would have been nice if I had a compiler directive of some sort to go one way or another depending on some condition. This is especially true where I might need to keep code portable between two different compilers. Also its a big problem when what needs to be different is in the *specification* of something. (Yes, I know, "One more layer of indirection...." can go fix it - but why should it be so hard?) Maintaining two sets of files has a problem - its two sets of files! :-) You change something in one file & you have to remember to make the update to the other one. You want to give the code off to someone else, you thus have to supply both sets of files and sufficient information to enable them to build it either way. Someone unaware of the parallel paths can really mess things up. Some sort of conditional compilation can simplify matters. (The existence of pragma Assert and pragma Debug in the Gnat compiler attest to at least *some* usefulness to conditional compilation.) I have sometimes been able to simulate conditional compilation by putting code into an if statement with a constant flag. Some compilers will optimize away the unreachable code. But that doesn't help much in declarative parts or in situations where a set of statements is acceptable to one compiler, but not another. I'd hate to see Ada develop into the unholy mess that C is with all of its macros and other confusing garbage, but maybe a couple of pragmas that let alternate versions of the code exist within a single file might not be a bad thing? MDC Jeffrey Carter wrote: > > > Generally, you define a package specification for the functionality you > require, then implement different bodies for it for the different > situations. > -- ====================================================================== 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 "Trying is the first step towards failure." -- Homer Simpson ======================================================================