News for hackers. Stuff that matters.
Re:Why does C++ think my class is copy-constructible when it... by rich_sasha on Tuesday June 10, 2025 @10:48AM (#44237486)
I used to code C++ in early 00s and used to think I know the language OK. Then I stopped using it, meanwhile C++11 and friends came, along with lambda syntax, move semantics etc. - that was a jump but I could still just about follow.

Now I don't follow anymore. It's a new language on top of new language on top of new language. On top of C++. On top of C.

Re:Why does C++ think my class is copy-constructible when it... by pjmlp on Tuesday June 10, 2025 @12:14PM (#44238543)
If only C added the C++ niceties in regards to bounds checking types, namespaces, modules, strongly typed enumerations,...

Still waiting for that C+ to come out of WG14.

Re:Why does C++ think my class is copy-constructible when it... by Night_Thastus on Tuesday June 10, 2025 @12:08PM (#44238487)
C++11 introduces a lot of things that make it far, far easier to work with. I would not want to go back to a pre-11 environment.

As for everything after that, you don't need to use those features. You can still write C++ like it's '11 and be none the lesser. That's what I do. Keep it simple.

Re:Why does C++ think my class is copy-constructible when it... by addaon on Tuesday June 10, 2025 @12:36PM (#44238791)
Yeah. C++11 was very much a new language “on top of” C++ — but it was a so much better language that learning it was a joy, and using anything predating it would be crazy. The minor tweaks since then are at times visually stunning (and not always in a good way), but are in the end quite minor, and can be safely ignored.
Re:Why does C++ think my class is copy-constructible when it... by rich_sasha on Tuesday June 10, 2025 @03:47PM (#44240687)
Yeah, I'm not saying these are bad changes! Only that it's so changed that I cannot read modern non-noddy C++, having been previously at least conversational, maybe fluent in it.
Re:Why does C++ think my class is copy-constructible when it... by bennettnate5 on Tuesday June 10, 2025 @07:31PM (#44242653)
The frustrating thing with layer-cake languages like C++ is that it can technically have all the ergonomic APIs that make life nice to write, yet have all this cruft and esoteric edge-case behavior that makes it so, so hard to read. I can't safely ignore features in C++ that others are using when I'm evaluating the correctness and security implications of already written code. And barring a strictly enforced (e.g. mandatory lint before merging) coding convention that bars all the nasty sharp points and legacy APIs, even a new project will gradually accrue the bad bits from devs who are used to using C++ that way.
Re:Why does C++ think my class is copy-constructible when it... by Night_Thastus on Wednesday June 11, 2025 @10:29AM (#44248014)
All languages that are sufficiently widely used eventually become 'layer-cake' languages.

It's inevitable once you have multiple big groups of people with very different needs. And once language design and best practices has evolved from where it was when the language was originally developed.

The only ones that escape this problem aren't widely used enough to have much demand for new features or changes.

Re:Why does C++ think my class is copy-constructible when it... by Bekwnn on Tuesday June 10, 2025 @05:10PM (#44241470)
In a similar boat with C++, but even the complexity of fundamental "simple C++" issues and lack of syntax sugar made me gravitate away from C++ to better-C style languages ultimately landing on Zig.

Using another language has only made me feel C++'s shortcomings more strongly than before.

Stroustrup even gave a talk about what a new C++ next language would look like and lands on many things better C languages already have implemented.

Sadly it's doubtful for gamedev to move away from C++ anytime soon. I am enjoying Vulkan+SDL in Zig on a personal project and can only hope that space of the language's community continues to grow.

Re:Why does C++ think my class is copy-constructible when it... by Night_Thastus on Tuesday June 10, 2025 @05:45PM (#44241820)
I find a lot of the syntactic sugar problems can be solved with a library. I use QT for a lot of my work and it is a fantastic library that saves me a lot of time. Using its strings are a breeze, not to mention QFile/QFileInfo/QDir for anything file related, QProcess for running external processes, etc. It's rich, well documented, and highly functional.
Re:Why does C++ think my class is copy-constructible when it... by adrian_b on Wednesday June 11, 2025 @03:50AM (#44245207)
There are also some features that have been introduced later, but which are so simple that they do not increase the cognitive load, so there is no need to avoid them.

For example, C++14 has introduced a digit separator in numbers, some 35 years after Ada. For me this is an extremely useful feature, because I have to use big constants from time to time, even if I hate any contributor to the C++ standard who has thought that instead of using underscore as the digit separator, like in Ada and in many languages that have followed Ada, it is a good idea to replace the underscore with the apostrophe.

There has never been any valid argument for using the apostrophe instead of the underscore. Underscore would have introduced a few subtle complications when parsing legacy programs, but that is also true for the apostrophe. Such complications could have been trivially avoided by forbidding a number to start with a separator.

Re:Why does C++ think my class is copy-constructible when it... by dh2022 on Tuesday June 10, 2025 @11:36AM (#44238129)
I have the same feeling. It seems to me these copy/move semantics are done for performance reasons, and at the same time are very hard to follow / use / implement correctly. Today I would rather use C or assembly language than C++. At least I know what I am doing.
Re:Why does C++ think my class is copy-constructible when it... by ainiriand on Tuesday June 10, 2025 @11:40AM (#44238176)
They are a shot in the foot waiting to happen.
Re:Why does C++ think my class is copy-constructible when it... by sitzkrieg on Tuesday June 10, 2025 @01:26PM (#44239229)
because people began to understand c++ again, the arsenal has expanded
Re:Why does C++ think my class is copy-constructible when it... by acchow on Tuesday June 10, 2025 @01:01PM (#44239025)
Not just performance. They enable smart pointers, reducing memory leaks and simplifying memory management
Re:Why does C++ think my class is copy-constructible when it... by sph on Tuesday June 10, 2025 @12:28PM (#44238697)
I have the same issue. Every time I feel I want to get better at C++ and learn what changed in the past 2 decades, I also have to contend with the fact that I'll have to learn cmake, that package management is non-existent, that compile times are atrocious and let's not forget the whole template abomination.

The day I need the performance and guarantees C++ can give me is the day I'll dive deep into Rust instead.

Re:Why does C++ think my class is copy-constructible when it... by saurik on Tuesday June 10, 2025 @01:07PM (#44239083)
The =default syntax might be new, but this should work the same if you use {}... I think this semantic has been the same the whole time I've used C++ (which seems to be a lot longer than you)? (Or like, is the issue with using the is copy constructable check from the standard library? Back in the late 90s we all had those, just in bespoke libraries.)
Re:Why does C++ think my class is copy-constructible when it... by rramadass on Wednesday June 11, 2025 @02:14AM (#44244677)
> I think this semantic has been the same the whole time

Yes; When you provide any of the "standard" ctors the compiler goes hands off leaving it entirely up to you to do the calls to any of the base ctors.

The article was just Raymond being surprised since as somebody else has already pointed out the api name is a bit of a misnomer.

Re:Why does C++ think my class is copy-constructible when it... by saurik on Saturday June 14, 2025 @01:47AM (#44274485)
Yeah: I am not responding to the article, or Raymond's surprise; I am responding to the comment of someone here annoyed at recent C++.