pointer sizes, was: Re: What does char **ch mean?

Richard A. O'Keefe ok at goanna.cs.rmit.oz.au
Fri May 17 19:09:18 AEST 1991


In article <466 at smds.UUCP>, rh at smds.UUCP (Richard Harter) writes:
> Prime machines (their native line, not the UNIX boxes they are reselling)
> are good exercises for the sloppy at heart.  Prior to PRIMOS 19.4, some
> pointers were 32 bits and some were 48 bits.  If memory serves me correctly
> (int *) was 32, (char *) was 48.  At some point they changed it so that all
> pointers were 48 bits.  Also (char *)0 was definitely not 0L; the extra 16
> bits hold information -- segment number or ring number or some such.

Wrong.  The format of pointers was
    - a 16-bit word, holding
	is pointer valid? 1 bit
	is pointer long?  1 bit
	which ring of protection?  2 bits (3 rings)
	which segment? 12 bits
    - a 16-bit word, holding
	which 16-bit word of that segment?  16 bits
    - an optional extension word (indicated by the "long" bit in word 1)
	which byte of that word? 1 bit
      OR
	which bit of that byte? 4 bits
The P400 I used didn't actually have any instructions that manipulated
bit addresses, but byte addresses were used.  The pointer valid? bit
was used for omitted arguments in procedure calls, amongst other things.
To choose a good NULL code, you'd need to understand the ramifications of
the PCL instruction.  (The machine _insists_ on passing 48-bit pointers
to procedures; the PCL instruction directly supports only pass by reference.)

> If your friend is only going to have one job in
> his life, work on only one machine in his life, and only use one compiler
> I see no reason why he should worry about these issues.

Exactly.
The universe is not only stranger than we imagine,
it is stranger than we _can_ imagine.
This applies to computers and C compilers too.
-- 
There is no such thing as a balanced ecology; ecosystems are chaotic.



More information about the Comp.lang.c mailing list