News for hackers. Stuff that matters.
Re:You can't make C++ not ugly, but you can't not try (2010) by downerending on Wednesday February 26, 2020 @06:52PM (#22428835)
You wish. Unless I'm terribly misinformed, "modern C++" contains all of the features of the prior versions, which means that in the real world you have to learn and deal with all of it.
Re:You can't make C++ not ugly, but you can't not try (2010) by jfkebwjsbx on Wednesday February 26, 2020 @06:57PM (#22428870)
That is the point of backwards compatibility. It is a feature, not a bug.

Whether that feature is a good idea or not and to what degree, is the question.

Re:You can't make C++ not ugly, but you can't not try (2010) by downerending on Wednesday February 26, 2020 @07:24PM (#22429057)
I'm not saying it's a bug. I'm saying that backwards compatibility means that you still have to deal with all of the historic flaws of the language today.

The article is indeed still relevant.

Re:You can't make C++ not ugly, but you can't not try (2010) by UncleMeat on Wednesday February 26, 2020 @07:47PM (#22429229)
But that’s true for literally everything. If you have a cpp code base and are building new stuff in rust to interop then you still have legacy cpp code even though rust has fewer problems.
Re:You can't make C++ not ugly, but you can't not try (2010) by KptMarchewa on Thursday February 27, 2020 @06:34AM (#22432390)
Not really. Legacy stuff can be contained. For example, you could specify language version level in file and it would disable removed/deprecated stuff.
Re:You can't make C++ not ugly, but you can't not try (2010) by UncleMeat on Thursday February 27, 2020 @01:13PM (#22435974)
Linters can prevent you from using outdated C++ constructs with ease.
Re:You can't make C++ not ugly, but you can't not try (2010) by Quekid5 on Wednesday February 26, 2020 @07:03PM (#22428914)
... but it's worth considering that this is a 'question' from 2010. Just saying...
Re:You can't make C++ not ugly, but you can't not try (2010) by gumby on Thursday February 27, 2020 @05:58AM (#22432253)
I don’t really understand your point. Just because all the implementations support the `asm` keyword doesn’t mean you need to know the assembly language of every CPU that has a c++ compiler.

You can write your code in modern c++ and ignore prehistoric carbuncles (some of which have been deprecated and eliminated FWIW). And you can call external code written in older dialects without having to look into its source code.

Re:You can't make C++ not ugly, but you can't not try (2010) by downerending on Thursday February 27, 2020 @12:21PM (#22435375)
That's great for a greenfield project where you're the only developer. If it's multiple people, you have to deal with whatever subset the powers-that-be on your team wish to use. If it's not greenfield, you have to deal with the subset exists in the codebase.

And if you're a Dirty Harry type like me, debugging issues with dozens of disparate codebases written in various crap subsets, you pretty much have to know the whole cursed thing.

Re:You can't make C++ not ugly, but you can't not try (2010) by saagarjha on Wednesday February 26, 2020 @07:27PM (#22429089)
Not everything; see for example std::auto_ptr.
Re:You can't make C++ not ugly, but you can't not try (2010) by downerending on Wednesday February 26, 2020 @07:39PM (#22429175)
Interesting (and also another thing to know).

Is there a list somewhere of features that have actually been removed from C++? (i.e., that would cause old code to break)

Re:You can't make C++ not ugly, but you can't not try (2010) by saagarjha on Wednesday February 26, 2020 @08:42PM (#22429555)
Here’s a list for C++17 and C++20, at least: https://mariusbancila.ro/blog/2018/07/05/c17-removed-and-dep...
Re:You can't make C++ not ugly, but you can't not try (2010) by Ragnarork on Thursday February 27, 2020 @09:43AM (#22433633)
> which means that in the real world you have to learn and deal with all of it.

This is not what happens in the real world though.

While I agree that you have to deal with whatever is in your codebase at a given point, it also doesn't imply that you have to use everything and that everything can be useful for your project.

As standards keep coming and features get added, it's still increasingly prevalent to see guidelines and awareness around the topic of choosing your own subset of C++ to work with.

The main drawback is mostly that it incurs a cost in terms of brain power to discipline yourself to keep your work within a restricted set of language and standard library features.

It's extremely rare (and even debatable) whether a single person masters all the aspects and features of C++ (and if there's one, it's probably Alexandrescu).

Re:You can't make C++ not ugly, but you can't not try (2010) by downerending on Thursday February 27, 2020 @12:25PM (#22435418)
In my world (see other reply), I get to deal with whatever is in dozens of codebases written in many times and places. The superset of everything they're using is pretty much everything.

Beyond that, even the "good" modern subset of C++ is crazy complex. I've sat in a room with some of the better C++ programmers in the world while they study and try to comprehend the new features like rabbis interpreting the Talmud.

If there's one concise, fundamental rule of software engineering, it's this: Complexity kills.

Re:You can't make C++ not ugly, but you can't not try (2010) by rumanator on Thursday February 27, 2020 @02:16AM (#22431349)
> which means that in the real world you have to learn and deal with all of it.

That makes as much sence as claiming that to develop software in, say, Python on the real world you have to learn and deal with all of its standard library.

That is not the case. That has never been the case ever for any programming language, be it large or small. Specially in C++, where since it's inception the standard approach is to, at best, adopt a subset of all features and stick with it.

Re:You can't make C++ not ugly, but you can't not try (2010) by tonyedgecombe on Thursday February 27, 2020 @05:09AM (#22432055)
Making a language so big and complex that you can't expect to understand it all isn't a good idea. You might be able to get away with using 50% of the language but if some project you depend on uses a different 50% then you have a problem.
Re:You can't make C++ not ugly, but you can't not try (2010) by rumanator on Thursday February 27, 2020 @05:24AM (#22432123)
IMHO C++ is unfairly singled out with regards to it's extension. That criticism rings true if applied to pretty much every single programming language ever devised, including "small" languages such as C.
Re:You can't make C++ not ugly, but you can't not try (2010) by downerending on Thursday February 27, 2020 @12:31PM (#22435493)
C, even today, fits entirely in my head. C++ does not.

I suspect this is not an uncommon situation among programmers.

Re:You can't make C++ not ugly, but you can't not try (2010) by 2zcon on Thursday February 27, 2020 @06:51AM (#22432478)
OK but if you're a competent, adult software engineer it should be fairly easy to overcome that problem.
Re:You can't make C++ not ugly, but you can't not try (2010) by tonyedgecombe on Thursday February 27, 2020 @07:50AM (#22432745)
Then why is it so common for people to try and select a subset of the language. Arguing about what people should do is pointless, you have to look at what they do do.
Re:You can't make C++ not ugly, but you can't not try (2010) by 2zcon on Thursday February 27, 2020 @12:59PM (#22435802)
If there are multiple ways of achieving the same result (e.g. assignment) and you want to be consistent, you have to choose a subset. If there are features that time has shown to be less-than-ideal (e.g. malloc/free) you choose a subset while the language avoids removing breaking backwards-compatibility.

So when you go to another project that made different decisions, what you should do is understand the decisions. It's quite easy. And that's why it's what people do do, and it's why people are capable of contributing to projects other than their first.

If you program in C++, it's the same skill you used to learn one or more of {CMake, Makefiles, scons, bash, python} except it's easier because you already understand the programming language's model.

Re:You can't make C++ not ugly, but you can't not try (2010) by rumanator on Thursday February 27, 2020 @10:48AM (#22434267)
> OK but if you're a competent, adult software engineer

"No true Scotsman" and all, please refrain from posting messages that add nothing of value besides petty insults thrown in broad brush strokes.

Re:You can't make C++ not ugly, but you can't not try (2010) by 2zcon on Thursday February 27, 2020 @12:50PM (#22435685)
Much as I didn't mean to insult anyone with my post, I'm sure you meant to add value by calling it petty and fallacious.

Picking up features in a language you already use is easier than learning the language to begin with which itself is easier than learning to program at all. If you were able to read the documentation to get to 50%, you have all the skills needed to pick up the rest and get to the difficult part of picking up a new project: understanding the problem space. If you're capable of learning the meaning of an API you've never seen before - and you will, if you're not writing your last project verbatim - then you're capable of learning what a lambda means. This is not me saying that all programmers should be able to do this, it's me saying that doing this is a predicate of engineering software.

Re:You can't make C++ not ugly, but you can't not try (2010) by rumanator on Friday February 28, 2020 @07:30AM (#22442289)
> Much as I didn't mean to insult anyone

You accused anyone who did not agreed with you of being incompetent and immature. In the very least own your own claims.

Re:You can't make C++ not ugly, but you can't not try (2010) by dang on Sunday March 01, 2020 @12:21AM (#22455264)
Would you please stop posting in the flamewar style to HN? You've been doing it a lot lately, and it's really not what this site is for. What we want here is curious conversation, which generally requires stepping away from the keyboard when feeling provoked, even if other people are doing or saying bad things.

https://news.ycombinator.com/newsguidelines.html

Re:You can't make C++ not ugly, but you can't not try (2010) by downerending on Thursday February 27, 2020 @12:29PM (#22435468)
If your job involves maintenance or support of multiple Python codebases, you do have to learn it all. And at least before Python 3, this wasn't that hard. (Python 3, unfortunately, has made the language a lot more complex.)