News for hackers. Stuff that matters.
Re:Pointers Are Complicated, or What’s in a Byte? by vardump on Wednesday July 25, 2018 @03:58AM (#17607595)
> A pointer is literally a stored memory address, i.e. an integer.

Consider:

  int a = 5;
  int* b = &a;
What happens when 'a' is allocated to a CPU register? If 'b' never escapes and no (undefined) pointer arithmetic is used, the compiler can simply consider '*b' as an alias to 'a'.

In this case the 'pointer' never actually points to memory.

> The thing the compiler manipulates could be called a "C pointer" or something.

Perhaps, although when talking about pointers, it's almost always in context of a particular programming language.

Maybe it'd be better to talk about "hardware pointers". Although on hardware level, from CPU point of view, a value or a register generally only becomes a "pointer" when it's used to compute a memory address for an instruction that accesses memory. (Excluding special hardware registers, like instruction pointer, page tables, DMA hardware or interrupt/exception vectors.)

So a "pointer" is always an abstraction in context of general purpose processing.

There are no comments on this comment yet.