C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Real World Programming, private = public

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sat, 02 Sep 2023 08:13:08 -0700
On Friday, 1 September 2023 16:07:47 PDT Frederick Virchanza Gotham via Std-
Proposals wrote:
> On Sat, Sep 2, 2023 at 12:00 AM sasho648 wrote:
> > What is there to standardise - it's working as it's in my opinion. Why do
> > you think it won't work with another compiler?
> Three problems:
> (1) If you do "#define private public" before including a header file,
> then it affects every class in that header file.
> (2) You can break SFINAE if a previously inaccessible method has
> become accessible, or if a private constructor has become public.
> (3) I don't know of any compiler on which it would cause an ABI break,
> but maybe there is one out there that would change the mangling of the
> name or the layout of the data members (or the order of function
> pointers in the Vtable).

3 is theoretically possible because:

(4) some non-standard-layout classes can become standard layout again

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

Received on 2023-09-02 15:13:09