# Trying to figure out if a modern computer is capable of manipulating arbitrarily large pointers

I was just thinking about Turing-completeness and its relationship with modern computers. I've always thought that a real computer is not technically Turing-complete. It is equivalent to a linear-bounded automaton; a Turing machine has infinite memory, whereas a real computer has only finite memory.

However, you can add memory to a computer through expansion cards, external mass storage drives, etc. The limiting factor then becomes the maximum size of pointers. Obviously, a 64-bit CPU can store a 64-bit pointer in its general-purpose registers, and languages like C/C++ can easily be modified to support 64-bit pointers. However, I'm not sure if they would be able to manipulate arbitrarily large pointers, and thus an arbitrarily large address space.

My thoughts are as follows: Most modern CPUs include instructions that allow for arithmetic involving arbitrarily large integers. For example, the Intel architecture has the ADC and SBB instructions, where the carry flag from the last operation is added or subtracted from the result of the current operation. This allows for addition and subtraction of arbitrarily large numbers in a piecewise fashion.

Theoretically, this could also be done with pointers. Say you want to increment a 1024-bit pointer by some amount. You simply add an immediately addressed value to the pointer using the ADC instruction in 16 successive operations.

The problem comes when you actually have to dereference the pointer. Intel CPUs, and probably most other CPUs as well, are incapable of operating directly on variables in memory, while simultaneously being incapable of storing an entire arbitrarily large pointer in the registers all at once. You can't dereference a pointer in a piecewise fashion; you have to dereference the entire thing. So it all boils down to the question of whether a pointer can be dereferenced in this fashion. It has occurred to me that I don't actually understand how pointer dereferencing is done at the machine level, and I would like someone to explain how this works.

Of course, this question is of no practical importance, because simply having 64-bit pointers allows for an address space that probably surpasses all the memory currently in existence. I am simply interested in this question from a theoretical standpoint.

• The keyword for what you are looking for is virtual memory. – André Souza Lemos Nov 25 '16 at 17:52
• I don't see how virtual memory solves this problem. It allows a process to have an address space that is not limited by the physical size of memory, but you still need pointers large enough to address data within that address space; the fact that the pointers refer to virtual addresses rather than physical addresses is not relevant. If pointers are 32 bits, the address space for a process is still limited to 4 GB, virtual memory or not. I am well aware of how virtual memory works, and how address translation works, but I don't see how it relates to this problem. – user628544 Nov 25 '16 at 17:56
• I didn't say it solves your problem, but it is a start. Arbitrarily large pointers would be made possible (in theory) by some kind of enhanced virtual memory scheme. My point is that this would be necessarily a software issue, as it is on Turing machines. – André Souza Lemos Nov 25 '16 at 17:59

The universe is finite, so you can't build a real turing complete computer.

The best you can do is build a computer which observes whether the program it is running is getting close to the limitations of the computer, and when it exceeds them, builds a new, bigger computer, with higher limits, transfers the code to the new computer, and starts all over again.

PS. It is quite possible (and not really very difficult) to build a computer with 256 bit pointers. Since the universe is not just finite, but has a known size, 256 bit pointers are enough for anything.

Only in any a hardware specific systematic way that I have ever found and I have been looking for examples of anything like this for sometime. I am an amateur, you may well know most of this but here goes;

Computing numbers larger than the wordsize can accommodate is called "bignums" and, as been commented, there are various software solutions to making use of large numbers easily found with google.

There is floating point which basically uses however many bits to represent the number of digits in an exceedingly large or miniscule number but this representation is obviously inaccurate as it represents every one of them as a zero and therefore cannot be used as an address scheme.

"having 64-bit pointers allows for an address space that probably surpasses all the memory currently in existence" I believe it is about 8Tb. As far as I know the 4GB limit is for programs assigning a memory location and is restricted for system security issues.

I googled "dereferencing pointers at the machine level instruction set" and found there is no current machine that can surpass this mechanically as the mechanical limit is set by the number of wires. The hardware itself can only use the timing and control signals that have been built into it.

You can, however, decide on which number of bits each address points to in various ways.

3.Register addressing. Operand address is not contained in instruction but in a register