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: kenner@lab.ultra.nyu.edu (Richard Kenner) Subject: Re: ifdef replacement for GNAT Date: 1998/04/13 Message-ID: <6gt525$ls1$1@news.nyu.edu>#1/1 X-Deja-AN: 343585133 References: <86g1jm2gcf.fsf@zappa> <6gn4q1$ee6@drn.newsguy.com> X-Complaints-To: usenet@news.nyu.edu X-Trace: news.nyu.edu 892475269 22401 (None) 128.122.140.194 Organization: New York University Ultracomputer Research Lab Newsgroups: comp.lang.ada Date: 1998-04-13T00:00:00+00:00 List-Id: In article <6gn4q1$ee6@drn.newsguy.com> nabbasi@earthlink.net writes: >Prof. Dewar, let me try to see what you mean by point (a) above by >an example (I am also one of those who learn better by examples, for no >other reason other than to be clear on what things mean): > >Lets assume we have UNIX and VMS (for the purpose of this example). > >Lets assume one wants to create a child process. on UNIX one calls fork(), >on VMS one calls vfork(). There are nowadays 3 main methods of how to >do this. Let me give my "take" on this, which is that you can't give a meaningful answer based on only *one* difference. If everything is portable except for one thing, it's hard to make a strong case about which way to handle that single non-portable thing. But there isn't just one thing; there are many. And there are also many more than two systems. So the whole point is to establish a methodology for handling the non-portable things and you can't illustrate that well with one thing and two systems. One way you do it is by abstracting them. You make a list of each of the areas of non-portability and find an interface that works for all systems for each of them. Then you can have one module that handles all the non-portablilities. Another is to try to find commonalities and conditionalizations that aren't necessarily system dependent. So suppose you find something that can be done one of two ways (e.g., big or little endian). Rather than conditionalizing each place with "systems A, B, C, D, and E are this way". Say "big endian is this way and little endian is this way". Then have a configuration file for each system saying which of the attributes is true for it. Very roughly speaking, the first approach is typically the way GNAT and GCC handles *host* dependencies and the latter is the way it handles *target* dependencies.