"peternilsson42" <peternilsso...@...> wrote:
> "Sharma, Hans Raj \(London\)" <hansraj_sharma@> wrote:
> > I have never seen difference in the sizeof(char *) and
> > sizeof(int *).
> > Is there any such system with a difference?
> 
> Why do you care? What advantage would you gain from them
> necessarily being the same?
> 
> The point is that the language standards allow them to be
> different. There have certainly been implementations where
> int and void pointers had different representations.

  "The issue is is that pointers of different types can have
  different  sizes. E.g. sizeof(int *) could be different to
  sizeof(char *). Consider an archirecture that is word
  addressed i.e. a native address representation can only
  select a specific word in memory. That would be fine for,
  say, int * but if the C implementation wanted to support
  bytes that were smaller than the system's word it would
  have to supply extra information in C pointer type such
  as char * in order to select the particular byte within a
  word. In that case sizeof(char *) may be larger than
  sizeof(int *)."
    -- Lawrence Kirby in comp.lang.c

-- 
Peter

Reply via email to