4 ms·
A pointer is just a number that points to addressable memory. Pointers don't even point to actual memory these days anyways. They're just glorified indices into
by _gabe_ 4y ago
A pointer is just a number that points to addressable memory. Pointers don't even point to actual memory these days anyways. They're just glorified indices into OS tables that eventually map to actual memory. You can increase a pointer to be 128 bits big, or 256 bits big if you wanted to. It doesn't change anything, because it's just an index.
Here's a clarification on Wikipedia that expands on this:
> nearly all programming languages are Turing complete if the limitations of finite memory are ignored.
And files are just as finite as a pointer. You can't address a location in a file bigger than sizeof(void*) on a modern computer. If you wanted to, you would need to add special support[1] and doing this is equivalent to what you would do to support a bigger memory range for pointers.
I'm curious, do you think other languages are Turing complete? As far as I know, all modern programming languages use a 64 bit addressable memory space maximum.
[0]: https://en.m.wikipedia.org/wiki/Turing_machine https://en.m.wikipedia.org/wiki/Turing_machine
[1]: https://stackoverflow.com/questions/4933561/what-is-the-relation-betwenn-file-pointer-width-and-maximum-file-size https://stackoverflow.com/questions/4933561/what-is-the-rela...
- camel-cdr 4y ago> You can increase a pointer to be 128 bits big, or 256 bits big if you wanted to. It doesn't change anything, because it's just an index. Yes, you can increase the pointer size arbitrarily, but it is always constant for a single C implementation, you can't increase the pointer size at run time. Essentially you recompiling and running a program and choosing an implementation with a successively larger pointer size is Turing complete, but it requires you as a special actor, and I'm only concerned for a what a single implementation can do. To put it in another way, solving the halting problem is trivial for any C program + a fixed C implementation, that doesn't have special language extensions. > I'm curious, do you think other languages are Turing complete? The easiest example would be brainfuck, because you can just move the tape around in it, and a theoretical implementation could trivially be hoked up to a theoretical infinite tape. > As far as I know, all modern programming languages use a 64 bit addressable memory space maximum I don't know enough about how other languages are defined, but I could imagine that Java allows for an implementation with infinite memory, because it doesn't impose any requirements on how the pointers are implemented under the hood.