"Numerical Recipes in C" is nonport

Sean Fagan seanf at sco.COM
Sun Sep 18 17:49:10 AEST 1988


In article <225800069 at uxe.cso.uiuc.edu> mcdonald at uxe.cso.uiuc.edu writes:
[lots of ranting and raving, deleted; see Doug Gwyn (the "normally sane")'s]
[reply for some good answers]
>I can conceive of an architecture where it
>is absolutely impossible to have code and data in the same address 
>space: say a physically different memory.

The PDP-11, using split I&D, is unable to generate code and then jump to it.
The 80386 (and, I think, the 80286) cannot execute data.  You have to change
permissions for the page (or segment, I forget which).  Um,  I don't see a
problem with this.

>somehow the system has to get code into the code memory,
>prehaps the only way being to write it to disk and read it out. 

Yep, that's how XENIX does it.  Reads it all into data segments, and then
changes it (magicly) into a text segment.  Again, I see nothing wrong with
this.

>I don't accept the argument that "our operating
>system doesn't allow user programs to do that". If it were in the
>C language spec they would have to CHANGE THE OPERATING SYSTEM TO
>MAKE IT WORK or else admit "our operating system is so broken that
>we can't have a C compiler".

(Please excuse me, I don't normally do this.  Also, I would like to
reiterate the disclaimer below:  I alone share my opinions.)

Your problem is that you grew up on a machine which could execute data (such
as a VAX), and you think that all machines should then be like that.  You
are ranting and raving, calling Doug Gwynn insane (ok, you didn't out and
out say that, but you darn well implied it), and also insuating that the
X3J11 committee, me, gobs of other people in the world, and the Intel
Microprocessor design team is brain damaged and/or incompetent (well, Intel
is questionable 8-) ).

Perhaps we should also put in bit counting operators into C.  Then, we could
write programs that require said operator, and say that all other machines
are slow and stupid because they don't have such things built into the
hardware (CDC Cybers do, Crays might, it was the only think I could think of
at 12:40 am 8-)).  Or maybe we should require that all ints be 32 bits.  And
doubles be 64 bits, to hell with any machine which has a superior floating
point scheme.

There is very rarely any need to be able to execute data that you have
created on the fly.  If you really need to, you can create an executable
relatively easily, and then execute that.  I, personally, dislike the idea,
but that's just MHO.  Not all machines are alike, nor are all memory
management schemes, nor are all operating systems.  And, like it or not, at
no point in C's history was it stated (or even implied) that you could jump
to data.  All the function pointers in K&R were assigned to functions
created by the programmer (such as main, exit, printf, etc.), or NULL (which
is, of course, a valid pointer).

Argc.

>Doug McDonald


-- 
Sean Eric Fagan  | "Joy is in the ears that hear, not in the mouth that speaks"
seanf at sco.UUCP   |     -- Saltheart Foamfollower (S. R. Donaldson)
(408) 458-1422   | Any opinions expressed are my own, not my employers'.



More information about the Comp.lang.c mailing list