Re: Pointers

From: Peter Ajamian (pajamian@cheapsam.com)
Date: 11/12/99


"Daniel A. Koepke" wrote:

> As a general rule, a pointer is a pointer, regardless of its type.  All
> pointers are 4 bytes on 32 bit computers (because, of course, an address
> on a 32 bit computer is 32 bits long, or 4 bytes).  Thus, the compiler
> does not treat, "char *temp = NULL;" any differently than it
> treats, "struct char_data *ch = NULL;".

This is not necessarily the case, while it is true that a 32 bit platform will
use 32 bit memory addresses a C pointer may hold more than just the base
address.  For example if a platform addresses its memory in 32 bit boundries an
implementation may choose to add an extra two bits to a char pointer so it can
point to any of four chars which would be addressed in that same 32 bit chunk,
how a particular implementation chooses to store its pointers is completely up
to the implementation, and the size of a pointer should never be assumed under
any circumstances.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST