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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,38159b1b5557a2e7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-21 16:05:14 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!news.litech.org!news-xfer.cox.net!peer02.cox.net!cox.net!pd7cy1no!pd7cy2so!shaw.ca!border1.nntp.ash.giganews.com!border2.nntp.sjc.giganews.com!border1.nntp.sjc.giganews.com!nntp.giganews.com!local1.nntp.sjc.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 21 Jan 2004 18:05:08 -0600 Date: Wed, 21 Jan 2004 19:05:07 -0500 From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Standard Ada Preprocessor (Was: why ada is so unpopular ?) References: <49cbf610.0401170627.79c3dfe5@posting.google.com> <400A9B48.3060100@noplace.com> <400BD4B5.6000307@noplace.com> <400BDB7C.40100@noplace.com> <400D2150.6000705@noplace.com> <400E72F9.8060501@noplace.com> In-Reply-To: <400E72F9.8060501@noplace.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.34.214.193 X-Trace: sv3-BLzYP+a+zeArNOjrXpSvQNP6RXqcDqp/FCwzyiXw/DRKhV3Aq3RR21sRQy/Nnfuf4gYntvaaPs+pkFX!0zd85HIYst2Zrwv24Qa7VWKfjE6bLuZKCUr+1lP7s4HFfIFRHKC1zGJB69CBFA== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: archiver1.google.com comp.lang.ada:4623 Date: 2004-01-21T19:05:07-05:00 List-Id: Marin David Condic wrote: > Ada ought to have some sort of answer for how to deal with maintaining a > single body of code that has to compile for more than one environment. > Even if you have the same target hardware and two different compilers > (even from the same manufacturer sometimes!) you can have statements > that will compile on one but not on the other. Isolation with separate > bodies is sometimes difficult to do and always complicates the build > process. Some form of conditional compilation would make the job easier. Technically what we expected way back when was that users would write code that depended on the value of System.System_Name, which was made an Ada constant for just that reason. (Compilers could evaluate "if System.System_Name = VAX then..." at compile time to eliminate any overhead.) In practice, two things prevented that. First, vendors didn't list all supported systems in package System, usually just the one you were compiling for. But more important was that the Ada culture quickly became to avoid dependencies on System for any reason whatsoever. Now, we are where we are: ----------------------------------------------------------- with Ada.Text_IO; use Ada.Text_IO; with System; use System; procedure System_Names is package Name_IO is new Enumeration_IO(System.Name); begin Put(" The Available System Names are: "); for I in System.Name'Range loop Name_IO.Put(I); if I = System.Name'Last then Put_Line("."); else Put(", "); if Col > 60 then New_Line; end if; end if; end loop; New_Line; Put(" Current System.System_Name is: "); Name_IO.Put(System.System_Name); Put_Line("."); end System_Names; ----------------------------------------------------------- E:\Ada\Test>system_names system_names The Available System Names are: SYSTEM_NAME_GNAT. Current System.System_Name is: SYSTEM_NAME_GNAT. Is there any compiler that produces a useful output? Of course, with GNAT at least I can modify system and recompile it. But of course, the usual is to do the easier thing, and have some other system dependent package defined by the project will all the dependencies depending on that. But that forces projects to do the version control that should come from the compiler switches. (The code generator has to know enough about the target to patch up System. But for that to work the type System.Name has to contain a useful set of names.) Incidently this is the first program I have written in a while that had a bug not caught by the compiler. For some reason Are was capitalized in one of the message strings. ;-) -- Robert I. Eachus "The war on terror is a different kind of war, waged capture by capture, cell by cell, and victory by victory. Our security is assured by our perseverance and by our sure belief in the success of liberty." -- George W. Bush