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