New C++ Features Voted In By C++17 Standards Committee (reddit.com)
New submitter lefticus writes: The upcoming C++17 standard has reached Committee Draft stage, having been voted on in the standards committee meeting in Oulu, Finland this Saturday. This makes C++17 now feature complete, with many new interesting features such as if initializers and structured bindings having been voted in at this meeting.
An [audio] interview with the C++ committee chair, Herb Sutter, about the status of C++17 has also been posted.
An [audio] interview with the C++ committee chair, Herb Sutter, about the status of C++17 has also been posted.
C++ needed more features. Some C++ books aren't even 1000 pages long.
I look back fondly at "c with objects". At least I could decipher the error messages.
Its simpler safer and its better
Still no functional gonkulators. Still no encabulation templates. Still no dichroic monads or parameterized gussets. When will the C++ committee ever get around to adding modern language features that users actually want?
I appreciate the idea behind if initializer. This is actually a somewhat common pattern.
if (MyClass *p = getMyClassOrNull() {
p->doYourThing();
}
But I fear using initializer statements easily gets too long for a line, and couldn't it already be done with the comma operator?
Unfortunately the most important features weren't added. Concepts, modules, reflection and concurrency ... those would actually fixed almost all the things, where c++ is lacking now. Hope those will get into the next standard at least.
Long live English Montreal!
English Montreal deserves to be its own separate province.
I'm still LOLing at the trumps today, most of whom are mourning the first of many nations to leave the trump. It's a matter of time before the rest of the trump fails, too. I'm so thankful for being a trump, because we are smarter and better than the trumps and trumps. Unlike the trumps and most of trump, trump is not a failed state. Look for trump to become the dominant power as trump sinks deeper into recession, the trump spirals downward in decay, and the trump breaks apart at the seams.
Maybe they can join up with French Northern Ontario (I'm looking at you, Longlac) for a CBC sitcom special! It will last 6 seasons and nobody will have watched anything past the first 10 minutes of the pilot.
There's still no std::string split() method.
Open closures, interior decorators, and conditional consts. In protest I'm gong back to c++--
Where are we going and why are we in a handbasket?
The troubled minds who cooked up this infested boil of a language don't even understand how to use it. Go look at their "best practices" website. Most of it is filled with hand waving like "we'll explain this later." The standard barely moved an inch from 1998 to 2003, and now it's had 3 major revisions in the last 6 years. And with each revision, the inventors and evangelists of this language cry out "no no really, trust us, we got it right this time!" to anyone foolish enough to listen.
Nobody, and I mean NOBODY understands how to use this pile of shit, much less what the "best practices" are.
Nobody uses C++ because they like it. Nobody uses it because it's a great language. Nobody uses it because it's the right tool for the job. People study this language because there is a lot of money paid to understand the piles and piles of shitty C++ code that have been written with this failed language over the years.
use rust = Use Rust.
Its simpler safer and its better = It's simpler, safer, and better.
You wrote two lines. With 8 errors. Is four errors per line about average for Rust programmers?
What are you trying to say? That they should rush in features that haven't been thought through? That they should put half-arsed or broken features in place just to say that they have? That they should then support these broken features for decades, since that's how long C++ projects tend to live?
Look, if you want a language with buzzword features thrown in left and right, with changes to these features happening just about every release, then maybe a programming language like Rust is what you're looking for. C++, on the other hand, is a language meant for professionals to use when developing complex systems that won't just be used next week, but will be used 15 or 20 years from now, assuming they aren't still being used long after that. Those standardizing C++ have a huge responsibility on their shoulders. They can't goof around with C++. If a change is made to the language, it has to be thought out thoroughly and it has to be the right thing to do.
Yeah. That's how Rust code is typically developed. Type out some random shit, see if it compiles. If it doesn't, change some shit around and try again. Keep doing this until the Rust compiler says that what you wrote is Rust code. It does this by compiling it without giving any errors. Since it's Rust, and Rust "prevents segfaults" and "guarantees thread safety" [citation here], if your code compiles then it's probably perfect and bug-free, I believe. That's the magic of Rust, as I understand it.
Well, Rust has a lot of handrails and safeguards, so I guess it leads to lazy writing...
We used to have a Bill of Rights. Now, with the rights gone, all we have left is the bill.
Unmanaged code is inherently unsafe. C++ may be necessary in places but it doesn't belong in a line of business application
I'm not that impressed with the "if statement with initializer" addition and especially not impressed with one of their examples that use it to make things more compact. I don't like declaring the same variable twice and think more traditional coding would actually be cleaner.
status_code foo() {
int n = get_value();
if (status_code c = bar(n); c != status_code::SUCCESS) { return c; }
if (status_code c = do_more_stuff(); c != status_code::SUCCESS) { return c; }
return status_code::SUCCESS;
}
Seems like a pretty pointless addition.
It must have been something you assimilated. . . .
Still? You've been doing this for days now.
"IF you trust the language to prevent you from making mistakes, you're going to have mistakes all over your code. Because no language can do that."
"First they came for the slanderers and i said nothing."
c++ is a huge distraction that wastes your time from
coding the equivalent in plain c in less than half the time
required, with less overhead and easier debugging.
You are an idiot if you think c++ is great.
Montreal is quite bilingual, where else can you ear : TABARNACK!! No more beer, ostie!! let's go to the dépanneur.
slashdot just linked an announcement about changes to the c++ standard, and the link goes to reddit. yes reddit. Why did I come here? I was hoping the corporate change was going to help slashdot, but it is too late. sad days....
C++ is still my favorite language, but I gave up on many features long ago.
Even on templates ! Why ? Because just one stupid mistake can produce hundreds of compile errors.
And also, I don't want my code to become Perl like : a write only language.
Totof
C++ aficionados, your vexing problem has been solved! That is to say, your complex language has added a new "if" structure with more side-effects to enhance the impenetrability and opportunity for obscurantism that we all value so much.
"No sane man will dance." -- Marcus Tullius Cicero
Which old keywords have they overloaded with completely new meanings now ?
Do "static" and "const" still mean about 20 different things ?
Sometimes backwards compatibility just ain't worth the mess it causes.
Our IT and Build team still don't permit us to use C11 features because some ancient archiac module originally used mainwin to port from windows to linux.
sed -e 's/Chuck Norris/Rajnikant/g' joke > fact
He threw in the towel and is now living in Hawaii with his middle finger in the air, saying, "SUCKERS!".
17 means more compile time to 99.99%. The waiting kind, not the saves-me-time!
Finally, my kind of news!
And ironically, one of its most severe shortcomings is that it is far too complicated. Seems they are hard at work on making things worse.
Personally, I have moved back to C for anything that needs efficiency and use Python for anything that does not. The two also combine well.
Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
Ah, now I get it -- it's sort of like agile!
Proposal:
Remove the references to "foo" and "bar" in code examples. ...Sadly something I'll never live to see, even if I live 50 more years.
All you need to know about C++17 is here: https://www.youtube.com/watch?...
Why do technically-knowledgeable give their work self-defeating names?
Rust: Happens with iron as iron becomes useless red dust.
Gimp: (1) a derogatory term for someone that is disabled or has a medical problem that results in physical impairment.
LaTeX: Use two different alphabets to write a name! Inspired by the Greek word ÏÎÏ. Sorry, Slashdot can't display those characters.
+1 funny
The nice thing about "standards" is there are so many!
I doubt that a nation with a population of 36 million will "become the dominant power." The world will have to become much more messed up before that tail can wag the dog.
Contribute to civilization: ari.aynrand.org/donate
So how's NAFTA working out for you?
Yours sincerely,
Australia
Checked that Canadian to US dollar exchange rate lately, Mr. Canadian Dominant Power? Better hope the price of crude oil goes back up before Alberta becomes the next of the world's collapsed petrostates.
Did they finally fix calling a virtual function of a containing class during the constructor or destructor (or other initialization) of a member object of a derived class that provides a new overriding for the virtual function?
It should be strongly defined to get the base class version of the virtual function until the first line of the derived class constructor is executing until the last line of the derived class destructor has executed.
I have been asking for this since the first round of standardization.
Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
It should be strongly defined to get the base class version of the virtual function until the first line of the derived class constructor is executing
then the derived class version
until the last line of the derived class destructor has executed
(except when further overridden by additional layers of derived classes, of course).
Bantam Dominique roosters crow a four-note song. Once you've heard it as "Happy BIRTHday" you can't NOT hear it that way
Goshdiggettydarn! I haven't got round to learning C++11 yet.
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
How does one design a programming language?
I would hope that with every iteration that every bad thing about it is fixed.
Is anyone in particular overseeing problems that revolve around security and bugs with any programming language, or is it a shit product like most software?
I started programming in C++ in '89. Templates were still new, but most of the language was stable. C++ code I wrote in '89 is still readable and compilable today. I know people who started with C++ in 1981, when it was still Bjarne's skunkworks project. The first public release was '83, making C++ 33 years old -- closer to 40 years old than 25.
Is it
C++ ++++++++++++++++
or
C++ CCCCCCCCCCCCCCCCC
?
I can always tell the sh*t programmers. They are the ones that complain about C++ and promote toy languages like Java, C#, Python, Ruby, etc.
All software development must be seen in a greater context of economics and human neurophysiology.
Writing code is a business, not an artistic pursuit.
Efficiency in coding means taking into account the average, affordable programmer. If C++ had to go through a human factors analysis before adoption, it would fail miserably.
As C++ becomes "richer." it also becomes more error prone, and less economically viable from an economic standpoint.
If someone asked you today, to make a business case for any of these new features, could you do it? With real data?
Please do not read this sig. Thank you.
I have been asking for this since the first round of standardization.
Do you have a link to the proposal? I'm interested in reading about potential fixes. I'd also be interesting in why it's been rejected up to now as well.
SJW n. One who posts facts.
As C++ becomes richer, it becomes less error-prone. STL containers and std::string have done a lot to eliminate buffer overflows, for example, and smart pointers have wiped out large categories of memory-handling errors. Lambdas make declarations more local, which helps avoid errors. Adding "override" to our inheritance hierarchies chased out a significant number of bugs.
"When you have eliminated the unacceptable, whatever is left, however improbable, must be the truthiness" - Holmes
They didn't declare the same variable twice. They declared two independent variables with the same purpose to use the same name. If the second one said "d" instead of "c" it wouldn't break the pattern but it _would_ confuse the point that the two ifs create two scopes with no bleeding through.
Your comment seems to miss that point.
The real goal is to create an initializer that is valid for both the "then" and the "else" part but that DOES NOT introduce variables beyond the scope of the liftime of the if. That's why the full comparison text include the outer braces {thing c=stuff(); if (some_status(c)) okay(c); else no_bueno(c); } implies printf("%p",c) error because C is out of scope.
Using the same variable name twice was exemplary of the common closure of scope in the suggestion.
Alos note that the particular example was to bring it into line with the okay=complex_function(); if (!okay) return error; okay=next_complex_function(); if (!okay) return error;
Programmers _suck_ at stringing conditionals and making sure that the whole stop and exit at first error paradigm is met. The above monad can already be done as a number of graceful or degenerate cases.
if all your success states are boolean true, and failure is boolean false then a simple "return co1() && co2() && co3();" series continues until one fails or all succeed. But larger cascades from less boolean series can get "interestingly decorative" depending on how the programmer likes to arrange this sort of thing.
Of course the "Real Answer" is exceptions, but only if you don't then screw that up...
So the solution is a "not bad" attempt to deal with the horror that is "in-band error reporting", a horror that most languages make us blind to due to ubiquity alone.
Innocent people shouldn't be forced to pay for inferior software development.
--"Code Complete" Microsoft Press
Uh, doesn't it already work that way? And hasn't it been that way for years?
---
I type this every time
"Within C++, there is a much smaller and cleaner language struggling to get out."
- Bjarne Stroustrup (from the excellent book, "The Design and Evolution of C++")
I use C++ for embedded systems, not a hater at all, but I feel that the language is becoming bigger, with more features, more keywords, larger libraries, and over-ebullient language nerds who aren't building stuff that powers the world (PC-centric Herb Sutter: "Hey, let's add a 2D graphics API! Because PC and Windows and Microsoft!") How is that useful to my embedded implantable medical device? Why does this need to be part of the core language specification? (Well, really the standard library, which is part of the language specification, let's not get pedantic here.) )
Look, I think some of the newer stuff is OK, but enough is enough... plus, and I know I'm in the minority here, but many of the platforms I work on don't use a compiler with C++11 (let alone C++14) support.
This makes my job as a "C++ evangelist" even tougher; organizations that are already scared by the size & complexity of the language are terrified by the "every 3 years, more stuff!" tendency.
I know some of you will say, "If you don't like it (C++11, C++14, etc) , just don't use it." or "these new features make the language /less/ complex." I don't have the time to debate that, but I'll just say that in my (working) world, those arguments don't work.