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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: spec/body/rep (Was: Compilation error (GNAT bug?)) Date: Tue, 27 May 2014 10:54:21 +0200 Organization: A noiseless patient Spider Message-ID: References: <537bd591$0$6621$9b4e6d93@newsspool4.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 27 May 2014 08:54:21 +0000 (UTC) Injection-Info: mx05.eternal-september.org; posting-host="23dab0694e4174fdc880833ec67fa650"; logging-data="12727"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19sbVyRZIM2SEOyTBV8ceHf" User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: Cancel-Lock: sha1:bbXbwv96bniLzKWSZAPPsPyliDY= X-Enigmail-Version: 1.6 Xref: news.eternal-september.org comp.lang.ada:20054 Date: 2014-05-27T10:54:21+02:00 List-Id: Le 27/05/2014 08:22, Niklas Holsti a écrit : >> And to ease porting, have a package called Target_Specific_Windows, >> > another one called Target_Specific_Linux. All the users do: >> > with Target_Specific; >> > >> > and have the following library-lever renaming: >> > with Target_Specific_Windows; >> > package Target_Specific renames Target_Specific_Windows; > I don't see what advantage such as a library-level renaming gives. If > one is developing for several platforms, say Windows and Linux, there > will then be two library-level renamings somewhere, one as above and the > other using Target_Specific_Linux, but some compiler-specific way is > still needed to choose which of the library level renamings to include > in the compilation. So one could just as well call both the > target-specific packages Target_Specific, directly, and use the same > compiler-specific way to choose which one to compile. For example, I use > GNAT's ADA_INCLUDE_PATH to choose the folder ("linux" or "windows") > which contains the version of Target_Specific to be compiled. The way I do it, both renamings are in the same file, one of them commented out. I just comment/uncomment the right one at the time of build. Not fully automated, but easy, and I argue (with the C people) that it is hardly more work than changing a global variable in a Makefile. The point is: one single simple change in one file, and your whole application switches OSes. The other benefit being that you see quite well which parameters are for which OS. But of course, it all depends on your build process, use case, and personal taste... -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr