C++ Logo

std-proposals

Advanced search

Re: [std-proposals] D3666R0 Bit-precise integers

From: David Brown <david.brown_at_[hidden]>
Date: Wed, 3 Sep 2025 21:46:58 +0200
On 03/09/2025 19:44, Oliver Hunt wrote:
>
>
>> On Sep 3, 2025, at 9:24 AM, Tiago Freire via Std-Proposals <std-proposals_at_[hidden]> wrote:
>>
>>> Objects are boxes, and have addresses
>> They don't have to.
>> Objects in C++ have a different meaning, I'm giving the benefit of the doubt that you are using the term loosely here.
>> Again, they don't have too, see above.
>
> Yeah, this is something where we need to be precise - it has different meanings between colloquial (non-specification) language, and specification language, coupled with “boxes” I can imagine people getting confused, especially if unfamiliar with c++ spec language. I have tended towards “blobs” as that seems to result in other readers understanding that object != instance of a record type.
>

Fortunately, we have the C++ standards that give meanings to terms like
"objects" and "values" are described. That's why I quoted from the
standard when describing them.

Unfortunately, the C++ standards are somewhat impenetrable for those
that are not very familiar with them. (And by the time any mere mortal
can get familiar with a version, a new version comes out with subtle
changes to the language and new library chapters.) Fortunately, C++
inherited its model of memory, objects and values from C before adding
its additional complications (such as the possible construction or
destruction of class instances stored within the object). And the C
standards are clearer. So under the "Terms, definitions, and symbols"
section of the C standards we have :

"""
*object*

region of data storage in the execution environment, the contents of
which can represent values.

Note: When referenced, an object can be interpreted as having a
particular type
"""

"""
*value*

precise meaning of the contents of an object when interpreted as having
a specific type
"""

Since that still seemed to be causing confusion, I tried the more
colloquial "boxes and their contents" model which is easy to understand
and consistent with C and C++.

This is the C++ standards proposals mailing list - it surprises me a
little that some people are active here without understanding the
fundamentals of how C++ works as a language. It is certainly easy to
get things wrong. For starters, C++ is often referred to as an "object
oriented language" and people regularly refer to instances of classes as
"objects". But that is not what the term means in C++ - like C, a C++
"object" is a region of storage.

It is worth reading the "Basics" section of the C++ standard, including
the "Memory and objects" subsection.


However, as someone else pointed out, this is straying a lot from the
OP's original questions. So I will leave things there.

Received on 2025-09-03 19:47:03