C++ Logo

sg12

Advanced search

Re: [ub] Draft 2 of Enhanced C/C++ memory and object model

From: David Vandevoorde <daveed_at_[hidden]>
Date: Thu, 28 Mar 2019 10:06:11 -0400
> On Mar 28, 2019, at 7:01 AM, Niall Douglas <s_sourceforge_at_[hidden]> wrote:
>
>>> I wasn't aware there is a difference between pointer objects and pointer
>>> values. I had assumed (I am guessing incorrectly) that pointer objects
>>> are trivially copyable and thus can be stored in registers.
>>
>> An object has storage associated with it, a value not so.
>
> I was not aware that CPU registers are not storage in the C++ abstract
> machine. Fascinating.

It’s called the _abstract_ machine for a reason: It’s not connected to concrete CPUs per se.

> I assume that storage is defined as something whose address can be
> taken?

It’s a tad more abstract than that: Bit fields also occupy storage, but their address cannot be taken.

> Hence CPU registers don't count as storage?

CPU registers are simply not a “thing” in the abstract machine or the normative wording (though they’re mentioned in notes). They’re a means to an end in concrete implementations. So I’m not sure this question can be answered.

[…]

 Daveed

Received on 2019-03-28 15:06:15