C++ Logo

std-proposals

Advanced search

Re: [std-proposals] User-Defined Trivial Constructors

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 11 Jan 2026 17:12:02 -0300
On Sunday, 11 January 2026 16:27:41 Brasilia Standard Time Sebastian Wittmeier
via Std-Proposals wrote:
> However, if those types are not implicit-lifetime types, the compiler or C++
> runtime or optimizer or some safety checker would perhaps need some hint
> about the already started objects residing there.
>
>
> From a practical standpoint, demanding the program to explicitly start the
> lifetime (or a better operation like resuming or sharing the lifetime)
> would perhaps be useful?

I disagree. If I get a void pointer to a shared memory area and static_cast it
to my type, it should be ok. As far as I can tell, it's no different than
getting a pointer to an object whose lifetime was started by another thread in
this program. If the latter is enough to the compiler, the former should too.

UBSan may need adjustments, but annotations for UBSan are acceptable. And
UBSan can know the provenance via non-anonymous mmap() too.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Data Center - Platform & Sys. Eng.

Received on 2026-01-11 20:12:18