Often programming language lectures and references have an illustration of computer memory as an array composed of individual cells. Each cell has an address, which is effectively the pointer and can be used to access it. I learned that 32 bit systems will have 4 byte pointers and then got curious what the (standard) capacity of those cells (they are pointing to) was. The most discrete unit of memory is a Memory Cell, but with 1 bit capacity, this does not really fit the bill.
-
$\begingroup$ Please edit the question to provide more context and background to help us understand what you are trying to learn. Where did you encounter this? What does "standard memory cell" mean for you? You write "the pointer" - what pointer is that? $\endgroup$– D.W. ♦Commented Jan 28, 2020 at 7:03
-
$\begingroup$ In many programming intro courses etc, they will have this illustration of memory as an array composed of individual cells. Each cell has an address, which is effectively the pointer and can be used to access it. I learned that 32 bit systems will have 4 byte pointers and then got curious what the capacity of those cells was. Search online did not yield immediate results. $\endgroup$– A.L. VerminburgerCommented Jan 28, 2020 at 8:19
-
$\begingroup$ Rather than leaving clarifications in the comments, please edit the question to make it read well for someone who encounters it for the first time and contain all relevant information, so people don't need to read the comments to understand what you're asking. Thank you. $\endgroup$– D.W. ♦Commented Jan 28, 2020 at 8:36
-
2$\begingroup$ I can point my finger at your little finger. I can point my finger at you. I can point my finger at a football stadium full with 100,000 people. And I can point my finger at the moon. $\endgroup$– gnasher729Commented Jan 28, 2020 at 8:45
1 Answer
That depends on the underlying architecture. Most machines today use byte addresses, but machines that addressed words (i.e. 16, 18, 32, even 36 bits) were reasonably common. If I recall correctly, most RISC machines were unable to address anything but words (but gave addresses in bytes). At least, such an address caused the CPU to fetch both words and snip out and assemble the piece wanted.
What your favorite language does above the machine's intrincacies, ask them. Often they will refuse to handle pointers that aren't aligned at some "machine natural boundary", like the size of a C double
, 8 bytes. Even on machines that have no penalty attached to non-aligned address acces.
-
2$\begingroup$ Just on a technical point, MIPS always had byte addressing (see cs.stackexchange.com/questions/28825/…) , and Alpha didn't originally (see cs.stackexchange.com/questions/53936/…). $\endgroup$– Pseudonym ♦Commented Jul 18, 2020 at 4:39