Sujet : Re: technology discussion → does the world need a "new" C ?
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.lang.cDate : 10. Jul 2024, 06:22:47
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v6l5r7$1pcjr$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : Mozilla Thunderbird
On 7/10/24 00:29, Lawrence D'Oliveiro wrote:
On Sat, 06 Jul 2024 15:38:14 -0700, Keith Thompson wrote:
...
If you evaluate the expression `array_object` in most contexts, it's
implicitly converted to a pointer *value*, pointing to the 0th element
of the array object. There is still no implicit pointer object.
The OP said “pointer”, not “pointer object” or “pointer value”. Not sure
what hair you are trying to split here.
BGB referred to it as an "implicitly declared" pointer. You can declare
objects in C, but not values. An object has a location in addressable
memory where it is stored, a value need not exist anywhere in
addressable memory.
In every implementation that I'm sufficiently familiar with, no memory
is set aside to store such a pointer object. A pointer value is formed,
if needed, by taking an address stored in a register and adding an
object-specific offset; the address stored in that address is of a group
of objects with the same scope, it only incidentally happens to also be
the address of one of those objects. And this is just as true of
pointers to individual objects as it is of pointers to the first element
of an array. That's convenient, since for the purposes of pointer
arithmetic, C considers single objects to be equivalent to a 1-element
array of that object's type.