News for hackers. Stuff that matters.
Re:C++ Patterns: The Badge by bdowling on Tuesday June 11, 2019 @06:59PM (#20160280)
The C++ access restrictions exist solely to teach and enforce proper API usage by other developers.

They're supposed to trigger a reconsideration of the API when a new developer runs into a restriction, but more often in my experience the new developer will just add a new public interface.

Re:C++ Patterns: The Badge by kazinator on Tuesday June 11, 2019 @08:11PM (#20160673)
And you can add yourself a public interface even if all you have is a compiled library, and header files.

Flipping a "private:" to "public:" has no effect on the binary compatibility.

Re:C++ Patterns: The Badge by slavik81 on Tuesday June 11, 2019 @09:26PM (#20160986)
> Flipping a "private:" to "public:" has no effect on the binary compatibility.

That's not the case on Windows. The access qualifier is part of the mangled name. https://en.wikiversity.org/wiki/Visual_C%2B%2B_name_mangling...

Re:C++ Patterns: The Badge by bdowling on Wednesday June 12, 2019 @04:08AM (#20162662)
It's still an honor system. There's a way to generate code that will call the "private" or "protected" data/function even if it violates what's specified in the headers.
Re:C++ Patterns: The Badge by kazinator on Tuesday June 11, 2019 @11:41PM (#20161598)
That shouldn't prevent the subversion of data members or inline functions, or the ability to add your own member functions to the class.
Re:C++ Patterns: The Badge by vnorilo on Wednesday June 12, 2019 @06:03AM (#20163138)
Because Badge is a template, this will produce a linker error (duplicate symbols).

Of course you can get around if you really, really want to. But I think this subthread is starting to split hairs.

Re:C++ Patterns: The Badge by dearrifling on Wednesday June 12, 2019 @12:52AM (#20161870)
It can change the "POD for the purpose of layout" status of a class on Itanium. It can change layout.