pointer -> long conversion - (nf)

jim at ism780b.UUCP jim at ism780b.UUCP
Wed Aug 1 14:24:53 AEST 1984

ism780b!jim    Jul 23 11:28:00 1984

> On machines with huge virtual address spaces, it is quite reasonable to
> keep addresses for the two separate.  Typically, virtual stack space
> could grow downward from 0xffffffff while the heap grows upward from
> 0x0.  On a small dedicated-application system with limited physical
> memory, and in which it is certain neither the stack and heap will grow
> beyond 32K, it would be quite reasonable to keep pointers inside data
> structures as 16-bit *signed* quantities.  In effect, one is modelling
> memory as a range around zero (0xffff8000..0x00007fff) instead of the
> usual notion of positive-number addressing (0x0..0x0000ffff).

No, one is modelling two distinct address spaces, [0..0x7fff] and
[0x8000..0xffff]; since there is no order relationship between the two,
it doesn't matter whether you sign-extend or not.  I would claim that,
whenever there is such an order relationship, it is much simpler to base
your addresses at 0 rather than at 0x8000 or 0x80000000, or whatever
depending upon your adress space size.

-- Jim Balter, INTERACTIVE Systems (ima!jim)

More information about the Comp.lang.c mailing list