sizeof in 36-bits machines

Richard H. Gumpertz rhg at cpsolv.UUCP
Sun Oct 15 03:10:51 AEST 1989


I see no reason that char could not be 8 bits on a PDP-10.  sizeof(long) might
then be 4.  There is nothing in C that talks about the bit-size of any type
being a multiple of the bit-size of char.  There is only stuff that talks about
sizeof.  There is nothing that prohibits extra bits between chars (e.g. the
low-order 4 bits for PDP-10 style 8-bit chars) as long as the addressing
mechanism skips over them.  Hence, as long as adding 4 to a char * really adds
1 to the word-address portion of a PDP-10 byte pointer, all should work fine.
Note that char * might be implemented as a PDP-10 style (LDB) byte-pointer
while int * might be a word pointer.  Conversion would happen upon type-casting.

I forget whether char must hold at least 8 bits and don't have a standard in
front of me.  If 7 bits is legal, the above discussion applies there as well,
with sizeof(int) being 5!  This would match traditional PDP-10 style ASCII!

Alternatively, you could just make sizeof(int)=sizeof(char)=1 and then have a
more traditional addressing scheme (even though char[...] might be inefficient).

I prefer the former implementation.
-- 
==========================================================================
| Richard H. Gumpertz    rhg at cpsolv.UUCP -or- ...uunet!amgraf!cpsolv!rhg |
| Computer Problem Solving, 8905 Mohawk Lane, Leawood, Kansas 66206-1749 |
==========================================================================



More information about the Comp.std.c mailing list