30

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.

5
  • 3
    Destination and pointed-to value are nouns... you're asking about the verb in the title. :-) May 26, 2010 at 18:51
  • I agree - it's never made any sense to me either why it's called that. I would prefer it if it were called 'following' or somesuch. May 26, 2010 at 19:01
  • I think your refering to the right direciton I was looking for. Is the word dereferencing a purely CS term? Without using that word in my life aside from this, I tried to assume what it ment, which is where I went wrong I think! Is it a word only used for this situation? Are there other examples where you would use this term? May 26, 2010 at 19:03
  • 1
    Just to confuse matters, the Windows kernel uses "dereference" to mean "decrement reference count": msdn.microsoft.com/en-us/library/ff557724%28VS.85%29.aspx
    – bk1e
    May 26, 2010 at 22:03
  • @PlatinumAzure getting still feels more appropriate to me
    – Coder
    Dec 20, 2020 at 3:03

3 Answers 3

44

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."

4
  • Can you give any other example of the word being used outside of CS? May 26, 2010 at 19:04
  • 1
    @optician: No; I think it's just technical jargon. May 26, 2010 at 19:05
  • Perfect, that section about the Latin bit was exactly what I was looking for! Thank you. May 26, 2010 at 19:34
  • 2
    I know it's late for this but "delimit" means to indicate the limit or boundary, rather than to take away limits; other examples include "denote," "demarcate," "delineate," etc.
    – foszter
    Jan 10, 2020 at 21:18
12

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.

3
  • Is it a purely cs term, or can you think of another situation where you would use the same word? May 26, 2010 at 19:05
  • There's thousands of CS terms that aren't used in "the real world"
    – Adam
    May 26, 2010 at 19:30
  • 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. May 26, 2010 at 19:32
3

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

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

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.