home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / c / 12886 < prev    next >
Encoding:
Internet Message Format  |  1992-08-27  |  1.3 KB

  1. Path: sparky!uunet!mcsun!sun4nl!and!jos
  2. From: jos@and.nl (Jos Horsmeier)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Why should POINTERS be so damn hard to understand ?
  5. Message-ID: <3345@dozo.and.nl>
  6. Date: 27 Aug 92 15:15:45 GMT
  7. References: <1992Aug26.183054.14146@newshub.ccs.yorku.ca> <l9nl34INNhln@almaak.usc.edu> <25233@castle.ed.ac.uk>
  8. Organization: AND Software BV Rotterdam
  9. Lines: 21
  10.  
  11. In article <25233@castle.ed.ac.uk> chas@castle.ed.ac.uk (C Spencer) writes:
  12. |
  13. |Why does a pointer need to know what it's pointing to? Surely it's just
  14. |an address - if there was only one kind of pointer, there wouldn't be so
  15. |much to learn, and be confused by.
  16.  
  17. But then we're forced to use explicit casts on _every_ pointer operation,
  18. there's no way then for the compiler to find out what code to generate
  19. for things like p->element, p++, *p etc. etc.
  20.  
  21. BTW pointers know next to nothing, they're just integral values, but for
  22. us regular folks, they're integral values (or `address values, if you like)
  23. with type information attached to it and so they are for the compiler. 
  24.  
  25. What you're describing resembles the semantics of pointers in BCPL.
  26. But BCPL knew of just one data type: the machine word. Life was easy
  27. in these days, as long as you didn't need several different types ...
  28.  
  29. kind regards,
  30.  
  31. Jos aka jos@and.nl
  32.