Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!gem.mps.ohio-state.edu!uakari.primate.wisc.edu!ark1!nems!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: PDP-11 data and function address spaces (was External ptrs and arrays) Message-ID: <20642@mimsy.umd.edu> Date: 9 Nov 89 07:51:06 GMT References: <530@dftsrv.gsfc.nasa.gov> <225800239@uxe.cso.uiuc.edu> <11567@smoke.BRL.MIL> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 30 In article <11567@smoke.BRL.MIL> gwyn@smoke.BRL.MIL (Doug Gwyn) writes: >By the way, the PDP-11 is the main example of a system where data and >function address spaces are distinct .... Before anyone jumps in and `corrects' Doug with stories of 11s in their college days (`why, when I was a boy, we had to carry our 11/40s 5 miles uphill through the snow to school each day, and 5 miles uphill back home again, where we could not even use it since the electricity was all DC, and . . .' :-) ), you should realise that PDPs came in different models and had different operating systems that used different capabilities. One of the (somewhat less frequently used) capabilities was what was called `split I&D', in which each machine address had to be qualified with `instruction' or `data' before it was unique. There were two separate locations 0400, one containing code, and one containing data. This is reflected in C in that char *p; int fn(); p = (char *)fn; is non-portable, and hence, even after such an assignment, the result of (*(int (*)())p)(); is at best non-standard. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris