views:

264

answers:

3

Why is dereferencing called dereferencing?

I'm just learning pointers properly, and I'd like to know why dereferencing is called that. It confused me as it sounds like you are removing a reference, rather than going via the pointer to the destination.

Can anyone explain why it is called this?

To me something like destination or pointed_to_value would make more sense.

+18  A: 

A pointer refers to an object. Ergo, we dereference the pointer (or, get the referent of the pointer) to get the object pointed-to.

The de- prefix most likely comes from the Latin preposition meaning from; I suppose you could think of dereference as meaning "to obtain the referent (or object) from the reference."

James McNellis
Can you give any other example of the word being used outside of CS?
optician
@optician: No; I think it's just technical jargon.
James McNellis
Pointers exhibit reference semantics.
DeadMG
Perfect, that section about the Latin bit was exactly what I was looking for! Thank you.
optician
+5  A: 

Dereferencing means taking away the reference and giving you what it was actually referring to.

A pointer to something really means that your pointer variable holds a memory address of something. But the pointer can also be thought of as a reference to something instead.

Brian R. Bondy
Is it a purely cs term, or can you think of another situation where you would use the same word?
optician
There's thousands of CS terms that aren't used in "the real world"
advs89
It sounded like it did some to do with making a pointer null, rather than finding something at the end of it. I think I thought that because I thought it sounded like a word that could exist in the real world.
optician
+2  A: 

Wiktionary only contains definitions related to programming: http://en.wiktionary.org/wiki/dereference

So it looks like it's really just technical jargon.

Francis Gagné