Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #10855
| From | jt@toerring.de (Jens Thoms Toerring) |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: RIP Dennis Ritchie |
| Date | 2011-10-14 21:43 +0000 |
| Organization | Freie Universitaet Berlin |
| Message-ID | <9fronaFng1U1@mid.uni-berlin.de> (permalink) |
| References | <P4idnVtpL9SdZQvTnZ2dnUVZ8ludnZ2d@giganews.com> <j77dqn$bb9$1@dont-email.me> <etrjm8-efs.ln1@hurricane.fredriksson.dy.fi> <j77vek$44m$1@dont-email.me> <4e986f9a$0$5796$65785112@news.neostrada.pl> |
Szyk <szyk100@o2.pl> wrote:
> >> The pointers in Pascal was a mystery for me.
> >
> > Find a copy of Cooper and Clancy's "Oh Pascal!" Best explanation of
> > pointers I ever read.
> The best explanation for pointers:
> >>>Pointers are memory adresses.<<<
> No less no more, no bs. Just asm experience...
There's more to pointers than just being memory addresses -
a pointer also comes with a type that controls how it is de-
referenced or what happens when an (integer) number is added
to it. If a pointer would be identical to an assembler memory
address each dereference would (as it is in assembler) require
specifying how many bytes at that address must be fetched.
And when you add a number to a memory address in assembler
the result is the direct sum of that number and the address,
while for a pointer it's the original value plus the product
of the number and the size of the type of what the pointer
points to.
Thus pointers are a higher-level constructs and not just mere
memory addresses. There would be no need for pointer casts in
C++ (or C) if pointers would be just memory addresses.
Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
RIP Dennis Ritchie Leigh Johnston <leigh@i42.co.uk> - 2011-10-13 15:38 +0100
Re: RIP Dennis Ritchie "A" <a@a.a> - 2011-10-13 16:43 +0200
Re: RIP Dennis Ritchie Paul Kuriakose <paul.kuriakose@comcast.net> - 2011-10-13 10:45 -0400
Re: RIP Dennis Ritchie Lynn McGuire <lmc@winsim.com> - 2011-10-13 14:22 -0500
Re: RIP Dennis Ritchie Donkey Hottie <donkey@fredriksson.dy.fi> - 2011-10-13 22:53 +0300
Re: RIP Dennis Ritchie red floyd <no.spam.here@its.invalid> - 2011-10-13 17:23 -0700
Re: RIP Dennis Ritchie Szyk <szyk100@o2.pl> - 2011-10-14 19:21 +0200
Re: RIP Dennis Ritchie jt@toerring.de (Jens Thoms Toerring) - 2011-10-14 21:43 +0000
Re: pointers jt@toerring.de (Jens Thoms Toerring) - 2011-10-15 22:27 +0000
Re: pointers Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-10-15 22:52 +0000
Re: pointers Pavel <pauldontspamtolk@removeyourself.dontspam.yahoo> - 2011-10-15 19:38 -0400
Re: pointers yatremblay@bel1lin202.(none) (Yannick Tremblay) - 2011-10-17 10:46 +0000
Re: pointers (was: RIP Dennis Ritchie) Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-10-17 03:01 -0700
Re: RIP Dennis Ritchie Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-10-17 03:00 -0700
Re: RIP Dennis Ritchie Markus Wichmann <nullplan@gmx.net> - 2011-10-18 10:35 +0200
csiph-web