It's a monster language, the Godzilla of the programming languages. But it gets the job done, as long as you use only 10% of its features.
A list of modern C++ features
41–50 of 68 posts
Re: A list of modern C++ features
#42Most features are very good. My favorite ones are range-based loops, lambdas, and strongly-typed enums. The things I dislike most are pairs and tuples. They make the code enormously harder to read, understand and debug, compared to non-standard classes or structures with meaningful member names. Even this guide promotes them in “using Coordinate = std::pair ;” Please, never do that, create your own class with x/y or…
Sometimes all the meaning is in the name of a thing (or in the name of a function returning such a thing) and member names dont help but hurt. x/y is a good example, why not a/b? I prefer not having to make these decisions. Also tuple assignment syntax is very nice from a usability standpoint (I don't think C++ has it, but e.g. Python has).
The author named their pair "Coordinate". In math and in computer graphics there’s widely known convention the fields of Cartesian coordinates are named x/y and not a/b.
When you’ll start writing code that use and/or modify those Coordinate values, meaningful names in C++ source and in the debugger help a lot.
Re: A list of modern C++ features
#43Re: A list of modern C++ features
#44I really wish a group of really smart dev get together and come up with a new language based just on the modern C++. Perhaps even call it MC++ (Modern C++). Make it's syntax as simple and easy to learn as Python and yet give us the performance close to the compiled C++. I'd take that knowing very well that I can't do all the powerful stuff I could with C, yet I have a safe and idiot-proof language to work with in my…
Re: A list of modern C++ features
#45Earlier 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…
Wow. Hyperbole much?
I get that you don't like C, but you sound like a raving lunatic who is completely unconnected with reality.
Devastating design flaws? Flaws I can agree with. Devastating? That sounds a bit overstated.
Caused many people to die? I call BS. (Yes, I'm pretty sure you might be able to document a few. But you said "many", and I'm calling you on it.)
Decisions made on a whim? Again, BS. In fact, at this point you're just making stuff up.
Re: A list of modern C++ features
#46I really wish a group of really smart dev get together and come up with a new language based just on the modern C++. Perhaps even call it MC++ (Modern C++). Make it's syntax as simple and easy to learn as Python and yet give us the performance close to the compiled C++. I'd take that knowing very well that I can't do all the powerful stuff I could with C, yet I have a safe and idiot-proof language to work with in my…
Rust?
Rust would be an obvious choice for what I described. It's been on my personal list for a while to learn Rust and make use of it. I think I will pretty soon.
I've been demotivated (to start) by reading over here on HN or elsewhere about how much of a learning curve it is to learn Rust. Perhaps, it was the bias that I already know what C++ was like in terms of syntax and idioms that made me ask for a choice with least friction.
Re: A list of modern C++ features
#47Yeah 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…
In a word: C++ is probably not for you(r application).
For that matter, I'd argue that this is a reasonable approach for every language.
Re: A list of modern C++ features
#48Re: A list of modern C++ features
#49I really wish a group of really smart dev get together and come up with a new language based just on the modern C++. Perhaps even call it MC++ (Modern C++). Make it's syntax as simple and easy to learn as Python and yet give us the performance close to the compiled C++. I'd take that knowing very well that I can't do all the powerful stuff I could with C, yet I have a safe and idiot-proof language to work with in my…
Nim's syntax is mostly pythonic, and it's metaproramming language is Nim (unlike C++'s abominable template metaprogramming language).
Re: A list of modern C++ features
#50Earlier 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…
> 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... Wow. Hyperbole much? I get that you don't like C, but you sound like a raving lunatic who is completely unconnected with reality. Devastating design flaws? Flaws I can agree with. Devastating? That sounds a bit overstated. Caused many people to die? I call BS. (Yes, I'm pretty sure y…
There are so many parts of C that are unsafe that a secondary tool is needed to have an reasonable type-checking and that tends to be devastating if they can be easily avoided by even safety critical engineers.
https://users.ece.cmu.edu/~koopman/pubs/koopman14_toyota_ua_... "Toyota does not claim to have followed MISRA Guidelines"
And honestly I dont think we agree on what "a few" is. In my book if any more than 4 or 10 people die from a solved problem in computer science (like strong typing, mutexes, and range checking) that is already way too yes many
As far as decisions on a whim compare the two language design efforts and i'll let you decide:
http://www.adapower.com/index.php?Command=Class&ClassID=FAQ&... "The requirements were not a language specification, but instead they attempted to define rigorously the needed characteristics in a form that could be critically reviewed."
https://www.codingunit.com/the-history-of-the-c-language “It’s entirely Dennis Ritchie’s work”