Sujet : Re: technology discussion → does the world need a "new" C ?
De : jameskuyper (at) *nospam* alumni.caltech.edu (James Kuyper)
Groupes : comp.lang.cDate : 06. Jul 2024, 19:26:47
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v6c298$3tko2$1@dont-email.me>
References : 1 2 3 4 5 6 7 8
User-Agent : Mozilla Thunderbird
On 7/6/24 04:51, BGB wrote:
...
Yeah, and in the 1D case, an array can be seen as functionally an
implicitly defined pointer with an assigned size and preassigned
backing memory.
>
Granted, C generally allows one to see the backing memory, but not the
implicit pointer to said backing memory. I guess one could argue that
if one can't take the address of it, it doesn't exist, but yeah...
C won't let you take that pointer's address because it need not exist,
and in my experience, usually doesn't. Compilers that I'm familiar with
often store all objects that are local to given scope in a single block
of memory whose starting address is stored in a register. No memory is
set aside to store separate pointer objects pointing to any of those
individual objects. When a pointer value pointing at one of those
objects is needed, a fixed offset is added to the address stored in that
register. Are you familiar with any compilers that handle such things
differently? I make no claim to wide knowledge of compilers, but the
compilers that I used which work that way are among the most widely used
C compilers.