Forthcoming update of C++ will include a standard library module named std:
C++ 23, a planned upgrade to the popular programming language, is now feature-complete, with capabilities such as standard library module support. On the horizon is a subsequent release, dubbed C++ 26.
The ISO C++ Committee in early February completed technical work on the C++ 23 specification and is producing a final document for a draft approval ballot, said Herb Sutter, chair of the committee, in a blog post on February 13. The standard library module is expected to improve compilation.
Other features slated for C++ 23 include simplifying implicit move, fixing temporaries in range-for loops, multidimensional and static operator[], and Unicode improvements. Also featured is static constexpr in constexpr functions. The full list of features can be found at cppreference.com.
Many features of C++ 23 already have been implemented in major compilers and libraries, Sutter said. A planned C++ 26 release of the language, meanwhile, is slated to emphasize concurrency and parallelism. Stackful coroutines also are slotted for C++ 26, according to February 20 blog post by ISO C++ committee member Antony Poluhkin.
(Score: 4, Interesting) by Mojibake Tengu on Thursday March 02, @02:07PM (10 children)
I appreciate the feature creep of the current C++ standard is complete. For now.
Exercise: Write a simple C++ program that does nothing but exits with zero. Compile it by C++23 compliant compiler. Link it. Check the size of resulting binary executable.
The edge of 太玄 cannot be defined, for it is beyond every aspect of design
(Score: 5, Informative) by stormreaver on Thursday March 02, @03:49PM (1 child)
gcc produced comparable sized binaries for C++ and C, stripped of debugging symbols.
(Score: 5, Touché) by stormreaver on Thursday March 02, @04:02PM
This was on a C++17 compiler, but it doesn't matter. The same complaints have been made for 20+ years, and they have proven to be overstatements every time. Each new generation of programmers seems to forget (or never learn) that C++ only includes features that are used in a given program. The entirely of the C++ code body does not get linked into the final binaries unless explicitly told to do so. Even if you include a library, only those library functions that are referenced in the program get included into the program.
(Score: 3, Interesting) by RamiK on Thursday March 02, @07:51PM (6 children)
The problem is that many c++ abstractions aren't zero runtime cost (smart pointers like unique pointers and lambdas for instance...) and whenever new features are added, new abstractions are added to the stdlib and the runtime implementation itself as refactoring happens and more and more redirections are added and it can't be fixed without breaking the abi... Well, it's all been mentioned around Google's Carbon discussions.
compiling...
(Score: 3, Interesting) by HiThere on Thursday March 02, @08:21PM (1 child)
IIUC, those features only bloat your code if you use them. And when they do, they do so for some particular gain of function, so calling it "bloat" is a bit unfair. If you hand coded the same functionality it would likely be larger. (There are some exceptions, where you are paying for the generality in the gained function by increases use of memory. Some people say you should never use std::set for example.)
Javascript is what you use to allow unknown third parties to run software you have no idea about on your computer.
(Score: 2) by RamiK on Thursday March 02, @09:17PM
libstdc++ for certain but also the compilers themselves are being written in modern c++ so they're not limiting themselves to raw pointers... Then you have the cost of destructors and the type overloading having at least an extra redirect... Literally everything in C++ ends up as having costs and while those costs make sense individually, they bloat as the standard and its implementation bloats.
Mind you, C's own abstractions also have costs. Zig brought those into discussion when it let both signed and unsigned ints overflow and warp like fortran... But the point here is that C++'s definition of zero cost abstractions was already dubious from day 1 when it comes to the actual implementation so when they won't let the ABI change it just gets worse and worse with every edition.
compiling...
(Score: 3, Insightful) by bart9h on Thursday March 02, @09:13PM (1 child)
smart pointers are just library functions, not core language feature.
(Score: 2) by RamiK on Thursday March 02, @09:25PM
I mentioned it in the other response but the compiler itself uses the stdlib so it gets into the runtime... It's not as bad with gcc and glibc but for llvm, for instance, it's pretty much all over the place.
compiling...
(Score: 1) by shrewdsheep on Thursday March 02, @10:23PM (1 child)
unique_ptr should actually be zero overhead. All it adds is to free an object automatically when the scope ends, which you otherwise would do manually. The unique_ptr is allocated on the stack but only contains the other pointer (so it's the same putting the other pointer on the stack). For lambdas, I believe, it is less clear but i reckon a lambda would have equivalent cost to constructing a context-structure that would be passed along with a function pointer to another function (that would be the traditional C-style, see e.g. glibc sort). Of course, in general there is added cost. For example, move semantics happens when objects have to be copied and the original can go away. In C-code having two objects could have been avoided in most cases, but code would be less clear.
(Score: 3, Informative) by RamiK on Thursday March 02, @11:44PM
I haven't looked at it for years but it should still be the case considering that's the guy who presented carbon a year ago: https://www.youtube.com/watch?v=rHIkrotSwcc&t=1060s [youtube.com]
Mind you, I think c++'s fundamental problem is its sheer complexity and size so carbon on its own isn't the full answer. My hope is that carbon will provide a transliteration tool to reliably convert most of c++ into readable and ready-to-compile carbon while leaving the hard parts in-lined and scoped similar to how java-to-kotlin-to-java works.
compiling...
(Score: 0) by Anonymous Coward on Friday March 03, @04:12AM
Sigh. Another loser that thinks he knows C++, but doesn't.
(Score: 5, Funny) by bzipitidoo on Thursday March 02, @03:50PM
One of my favorite C++ obfuscation tricks was the C++ comment ending with a backslash. Backslash at the end of a line means that the next line should be considered a continuation of the current line, and therefore a line following //\ would be considered a comment. But, if a space came after the backslash, then the comment didn't end with a backslash and the next line would be considered code. Invisible context, woohoo! Ranks up there with makefiles not working if tabs are converted to spaces. C++23 fixes this issue.
(Score: 5, Touché) by sjames on Thursday March 02, @06:40PM (8 children)
By complete, I presume they mean that it is now possible to write a program compliant with C++ 23 that cannot be recognized as C++ if you last worked with it in the '90s?
(Score: 2) by DannyB on Thursday March 02, @09:37PM (3 children)
I last worked with it in the 90's. I wonder if I would even recognize it now? I wonder if my source would compile? I was using MetroWerks Code Warrior at the time. I also had Symantec C++ version 7 and 8, but version 8 suddenly was severely broken and they shipped it (late) anyway.
How often should I have my memory checked? I used to know but...
(Score: 2, Informative) by shrewdsheep on Thursday March 02, @10:27PM (1 child)
Stroustrup et al. claim there is full backward compatibility but I wouldn't hold my breath. In principle, semantics has never been changed, only been added to the language.
(Score: 4, Interesting) by sjames on Friday March 03, @02:46AM
OTOH, in another forum I just saw a case of needing to use an older compiler to compile older C++ code.
(Score: 3, Interesting) by sjames on Friday March 03, @02:51AM
I work with it occasionally, mostly in embedded coding where one is strongly advised to keep it simple and use it mostly like a slightly extended C. Last year I looked at some C++ written to the latest standards and had several WTF moments.
(Score: 2) by Rich on Thursday March 02, @10:36PM (3 children)
The correct term for this is "modern C++".
(Score: 3, Funny) by DannyB on Thursday March 02, @10:39PM (2 children)
That makes me wonder. What will they call it when it gets even more modern?
How often should I have my memory checked? I used to know but...
(Score: 2) by Rich on Friday March 03, @12:11AM
They'll still call it "modern C++", but then you'll need to purchase their additional courses about "understanding the 'modern' in C++" to understand the current state of "modern".
I think the main purpose of C++ by now is that they slap together a new standard in 6 months, make a lot of noise about it in the next 6 months and then tour big corporations with expensive lectures from "The ISO Standard Editors" for two years. Not that the attendees would be able to fully understand and memorize the content of a single item of the TFA linked changes. But the C++ inner circle makes a decent living off two Fortune 500 gigs a week with a dozen attendees each, at $2495 per seat.
(Score: 3, Touché) by sjames on Friday March 03, @02:55AM
Postmodern. Then they'll eat over-hyped hip caviar and sip over-priced mediocre wine with a designed label and talk about how C++ 23 is so last week.
(Score: 3, Interesting) by corey on Thursday March 02, @09:08PM
I’m trying to get up to date with C++ because the last time I coded with it was in ~07. So many updates to get my head around and now another.
Same with Python, it is barely recognisable from what I was used to back in version 1.5 (~2009?). Shorthand, code hinting, etc. Maybe I should stick to hardware engineering.
(Score: 0) by Anonymous Coward on Friday March 03, @04:15AM (1 child)
In before all the losers too stupid to understand a real programmer language like C++, start making comments.
(Score: 2, Funny) by Anonymous Coward on Friday March 03, @08:51AM
Asking for a friend: are there other "real programmer"-languages out there?