Newsgroups: comp.lang.c Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: Different pointer representations on the same machine Message-ID: <1989Feb15.200416.15836@utzoo.uucp> Organization: U of Toronto Zoology References: <3675@arcturus> Date: Wed, 15 Feb 89 20:04:16 GMT In article <3675@arcturus> evil@arcturus.UUCP (Wade Guthrie) writes: >I have seen references on the net to computers which have different >representations for different types of pointers (even some computers >which represent different types of pointers as different sizes). > >Could I have some examples... The usual reason for this is that the machine was designed as a word- addressed box and does not easily support pointer-to-character. This means that pointer to character needs enough extra bits to address a character within a word. On machines with wide words, the extra bits can often be found within a pointer, as "unused" bits; then one just needs special code for handling pointer-to-character that (a) picks those bits out, (b) uses the rest of the pointer to access a word, and (c) uses the picked bits to pull a character out of that word. The PDP-10 and the Cray-1 are examples of such machines (the 10 is an unusually favorable case because it has some instructions that do roughly what's wanted). On machines with narrow words (e.g. 16-bit word-addressed machines), the situation is much stickier, because there usually aren't any spare bits in a pointer. Then one may have to add a whole extra word to the representation of pointer-to-character to contain the extra bit(s), with appropriate changes in code generation anywhere such pointers are used or moved around. Some of the smaller Data General machines are like this, as are other minicomputers of similar vintage. Pointer-to-short can also need such arrangements on word-addressed machines with fairly wide words. -- The Earth is our mother; | Henry Spencer at U of Toronto Zoology our nine months are up. | uunet!attcan!utzoo!henry henry@zoo.toronto.edu