Path: utzoo!yunexus!geac!daveb From: daveb@geac.UUCP (David Collier-Brown) Newsgroups: comp.lang.c Subject: Re: "Numerical Recipes in C" is nonportable code Message-ID: <3200@geac.UUCP> Date: 4 Sep 88 14:06:20 GMT Article-I.D.: geac.3200 References: <867@osupyr.mast.ohio-state.edu> Organization: GEAC Computers, Toronto, CANADA Lines: 29 > In article <8395@smoke.ARPA>, gwyn@smoke.ARPA (Doug Gwyn ) writes: >> [From way past] > Such an implementation will ABORT ON THE COMPUTATION `b - 1', >> That is not an X3J11 invention, just an acknowledgement of the >> way the world is. (For example, segmented architectures.) From article <867@osupyr.mast.ohio-state.edu>, by vkr@osupyr.mast.ohio-state.edu (Vidhyanath K. Rao): > But why should it abort? If the address is sr:0, (sr = segment register) > subtract 1 to get (sr-1):ffff [or whatever number of 'f's]. Memory > protection, it seems to me, should not notice attempts to compute addresses > but only attempts to access forbidden addresses. Regrettably, some architectures prohibit this: (sr-1):ffff may mean :ffff, and the loading of the selector into an selector register will cause a fault. The basic idea here is that the operating system pre-fetches a page or segment on being informed that the program is "about" to need it, as indicated by loading its selector into a distinguished register. This behavior is possible on the Honeywell DPS-6[1], and certainly on an Intel machine running a non-DOS operating system. --dave (@lethe) c-b [1] I think the compiler writers watch out for this happening, but I do know that it makes compiler- & debugger-writing **difficult**. Anyone from SDG want to comment? -- David Collier-Brown. | yunexus!lethe!dave 78 Hillcrest Ave,. | He's so smart he's dumb. Willowdale, Ontario. | --Joyce C-B