Live data from Hacker News

A list of modern C++ features

github.com

21–30 of 68 posts

Re: A list of modern C++ features

#22
The one feature that really annoys me is the std::optional. This is awesome and very needed feature however it is too clunky for something that should be used very frequently. Swift does such a nice job with its '?' operator, I wish C++ had something similar.

Re: A list of modern C++ features

#23
post #19
post #14

Earlier quoted context omitted.

And every time there was a language designed against PL/I like languages, with the goal of fighting complexity, its adoption by the industry lead to feature growth and becoming just as complex, usually with solutions hindering by backwards compatibility. Yes C++ is complex, but so are Python, Ruby, Ada, Fortran, C#, F#, Haskell, OCaml, Java... Even Go will get caught in the complexity game if it gets enterprise adopt…

The big difference here is how additions in C++ tend to work - e.g. keeping all of the deprecated ill-defined legacy and growning features on it like tumors until there are no more symbols left. Unlike Ada and Python which aren't afraid of throwing away poor design and were overall more thought out in the first place (especially Ada). Its not a "complexity game" in so much as poor design being over-compensated for. C…

How specially Ada?!

The only thing Ada has thrown away was GC support that no compiler vendor has ever bothered to implement.

What other features were thrown away across Ada83, Ada95, Ada2005 and Ada2012?

If I present you Ada random code snippet X, are you sure you will be able to say which language version it requires?

Also Python is the poster child of what happens when you throw compatibility away.

Re: A list of modern C++ features

#24
post #23
post #19

Earlier quoted context omitted.

The big difference here is how additions in C++ tend to work - e.g. keeping all of the deprecated ill-defined legacy and growning features on it like tumors until there are no more symbols left. Unlike Ada and Python which aren't afraid of throwing away poor design and were overall more thought out in the first place (especially Ada). Its not a "complexity game" in so much as poor design being over-compensated for. C…

How specially Ada?! The only thing Ada has thrown away was GC support that no compiler vendor has ever bothered to implement. What other features were thrown away across Ada83, Ada95, Ada2005 and Ada2012? If I present you Ada random code snippet X, are you sure you will be able to say which language version it requires? Also Python is the poster child of what happens when you throw compatibility away.

What I meant to emphasize was that Ada was well designed in the first place, and yes GC was a problem and so were some of the restrictions and aspects of the standard libraries. For example, a big one was unconstrained types for generic actuals...

C is a mine-field of devastating design flaws which have caused many people to die because of decades old decisions made on a whim and any change to basic libraries to make them safer and removing dangerous functions is heresy.

As far as Python, yes the two versions of the language is troublesome for users but the language is objectively better and students learning programming for the first time benefit from a more robust version.

Feel free to give me a random code snippet ;p

Re: A list of modern C++ features

#25
post #8

I really wish there would be a linter (I realise it's probably a nearly impossible task) which would complain when you use legacy, unsafe language features. As someone who doesn't work in C++ or have the benefit of 10 years experience to see the flaws, trying to write modern, safe C++ is essentially impossible. I spent a solid week trying to write something safe and only use C++14/17 features when they were available…

Or even better, at some point they should introduce "safe mode" or "strict mode", where you turn on a compiler flag.

aka -Weverything ;)

Re: A list of modern C++ features

#26
post #24
post #23

Earlier quoted context omitted.

How specially Ada?! The only thing Ada has thrown away was GC support that no compiler vendor has ever bothered to implement. What other features were thrown away across Ada83, Ada95, Ada2005 and Ada2012? If I present you Ada random code snippet X, are you sure you will be able to say which language version it requires? Also Python is the poster child of what happens when you throw compatibility away.

What I meant to emphasize was that Ada was well designed in the first place, and yes GC was a problem and so were some of the restrictions and aspects of the standard libraries. For example, a big one was unconstrained types for generic actuals... C is a mine-field of devastating design flaws which have caused many people to die because of decades old decisions made on a whim and any change to basic libraries to make…

I fully agree with you regarding C, but even though C++ happens to be copy-paste compatible with it, C++ isn't C.

It does provide the necessary language features for security conscious developers to write safe code, the fact that many write C++ as if it was "C with C++ compiler" is an unfortunate one.

Yes it would have been great that we had Ada instead of C++, sadly that wasn't what greedy Ada compiler vendors wanted us to have.

Re: A list of modern C++ features

#27

Earlier quoted context omitted.

Thanks, that page looks like hell, but I recognise a few terms. http://clang.llvm.org/extra/clang-tidy/ is much more approachable, and gives a solid overview. The introductory sentence gave me project-naming cancer: > clang-tidy is a clang-based C++ “linter” tool. Then why is it called tidy ??? It appears first on page three of google's search results for "C++ linter" in spite of the fact that anything from LLVM is p…

> Then why is it called tidy ??? https://en.wikipedia.org/wiki/HTML_Tidy

It's also a (possibly unintentional) play on the British slang term "bang tidy" http://www.collinsdictionary.com/dictionary/english/bang-tid...

Re: A list of modern C++ features

#28
post #16

Yeah more features is exactly what C++ needed... Am I the only one who uses C++ as C with classes? Sometimes I use vectors or strings and I like default values in functions and other minor improvements to C. I don't want to reimplement the n'th version of string concatenation when I can just use the "+" operator, sure... and there starts the rabbit hole. Before you know it you have a "protected abstract virtual base…

I use C++ mostly like "C with classes" and for me (a low-level game programmer) it's close to ideal. It absolutely baffles me that there is not yet a language that's explicitly a thoughtfully-designed "C with classes".

Re: A list of modern C++ features

#30
post #26
post #24

Earlier quoted context omitted.

What I meant to emphasize was that Ada was well designed in the first place, and yes GC was a problem and so were some of the restrictions and aspects of the standard libraries. For example, a big one was unconstrained types for generic actuals... C is a mine-field of devastating design flaws which have caused many people to die because of decades old decisions made on a whim and any change to basic libraries to make…

I fully agree with you regarding C, but even though C++ happens to be copy-paste compatible with it, C++ isn't C. It does provide the necessary language features for security conscious developers to write safe code, the fact that many write C++ as if it was "C with C++ compiler" is an unfortunate one. Yes it would have been great that we had Ada instead of C++, sadly that wasn't what greedy Ada compiler vendors wante…

Indeed, except for all the flaws C++ decided to add from C including is cryptic syntax (i++, ++i, In fact, from that list it seems like it is finally meeting parody on key Ada 95 features -- so maybe we dont have to be so sad :)
Post reply on HN