C++ Logo

std-proposals

Advanced search

Re: [std-proposals] int Func(void) noreentry(-1)

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 12 Feb 2023 18:21:32 -0800
On Sunday, 12 February 2023 17:08:04 PST Frederick Virchanza Gotham via Std-
Proposals wrote:
> We already do this. We already have language features in C++ that hide
> extra data inside each object. If I change:
>
> struct Monkey {
> int i;
> };
>
> to:
>
> struct Monkey {
> int i;
> virtual ~Monkey(void) {}
> };
>
> Then sizeof(Monkey) mysteriously gets bigger. It's because we're
> hiding something in there.

Fair, but that's a declaration in the class body. Your syntax would need that
too.

Your paper needs to explain why a core language change is better than adding a
mutex member to the class, since one must edit the class anyway. A core
language change requires an explanation why it's so much better than the
equivalent library-only solution.

You can point out existing precedents, but you need to understand the context
of them. It's not a good precedent if the syntax you're comparing to was
needed because there was no other solution (the case of virtual tables) or
because the solution came to fix an earlier problem (thread-safe function-
static initialisation).

So far, I haven't seen it.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-02-13 02:21:34