TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

21st Century C++

177 pointsby bandwitch4 months ago

31 comments

coffeeaddict14 months ago
The C++ Core Guidelines have existed for nearly 10 years now. Despite this, not a single implementation in any of the three major compilers exists that can enforce them. Profiles, which Bjarne et al have had years to work on, will not provide memory safety[0]. The C++ committee, including Bjarne Stroustrup, needs to accept that the language cannot be improved without breaking changes. However, it&#x27;s already too late. Even if somehow they manage to make changes to the language that enforce memory safety, it will take a decade before the efforts propagate at the compiler level (a case in point is modules being standardised in 2020 but still not ready for use in production in any of the three major compilers).<p>[0] <a href="https:&#x2F;&#x2F;www.circle-lang.org&#x2F;draft-profiles.html" rel="nofollow">https:&#x2F;&#x2F;www.circle-lang.org&#x2F;draft-profiles.html</a>
评论 #42989403 未加载
评论 #42954786 未加载
评论 #42955974 未加载
评论 #42956185 未加载
评论 #42988075 未加载
评论 #42954873 未加载
评论 #42954468 未加载
评论 #42957981 未加载
评论 #42966264 未加载
评论 #42954574 未加载
评论 #42989127 未加载
vr464 months ago
Last weekend, I took an old cross-platform app written by somebody else between 1994-2006 in C++ and faffed around with it until it compiled and ran on my modern Mac running 14.x. I upped the CMAKE_CXX_STANDARD to 20, used Clang, and all was good. Actually, the biggest challenge was the shoddy code in the first place, which had nothing to do with its age. After I had it running, Sonar gave me 7,763 issues to fix.<p>The moral of the story? Backwards compatibility means never leaving your baggage behind.
boris4 months ago
&gt; [M]any developers use C++ as if it was still the previous millennium. [...] C++ now offers modules that deliver proper modularity.<p>C++ may offer modules (in fact, it&#x27;s been offering them since 2020), however, when it comes to their implementation in mainstream C++ compilers, only now things are becoming sort of usable with modules still being a challenge in more complex projects due to compiler bugs in the corner cases.<p>I think we need to be honest and upfront about this. I&#x27;ve talked to quite a few people who have tried to use modules but were unpleasantly surprised by how rough the experience was.
评论 #42989943 未加载
mindcrime4 months ago
I was an extreme C++ bigot back in the late 90&#x27;s, early 2000&#x27;s. My license plate back then was CPPHACKR[1]. But industry trends and other things took my career in the direction of favoring Java, and I&#x27;ve spent most of the last 20+ years thinking of myself as mainly a &quot;Java guy&quot;. But I keep buying new C++ books and I always install the C++ tooling on any new box I build. I tell myself that &quot;one day&quot; I&#x27;m going to invest the time to bone up on all the new goodies in C++ since I last touched it, and have another go.<p>When the heck that day will <i>actually</i> arrive, FSM only knows. The will is sort-of there, but there are just SO many other things competing for my time and attention. :-(<p>[1]: funny side story about that. For anybody too young to remember just how hot the job market was back then... one day I was sitting stopped at a traffic light in Durham (NC). I&#x27;m just minding my own business, waiting for the light to change, when I catch a glimpse out of my side mirror, of somebody on foot, running towards my car. The guy gets right up to my car, and I think I had my window down already anyway. Anyway, the guy gets up to me, panting and out of breath from the run and he&#x27;s like &quot;Hey, I noticed your license plate and was wondering if you were looking for a new job.&quot; About then the light turned green in my direction, and I&#x27;m sitting there for a second in just stunned disbelief. This guy got out of his car, ran a few car lengths, to approach a stranger in traffic, to try to recruit him. I wasn&#x27;t going to sit there and have a conversation with horns honking all around me, so I just yelled &quot;sorry man&quot; and drove off. One of the weirder experiences of my life.
评论 #42987176 未加载
评论 #42987146 未加载
评论 #42987161 未加载
评论 #42994500 未加载
评论 #42987418 未加载
tialaramex4 months ago
Here&#x27;s how Bjarne describes that first C++ program:<p>&quot;a simple program that writes every unique line from input to output&quot;<p>Bjarne does thank more than half a dozen people, including other WG21 members, for reviewing this paper, maybe none of them read this program?<p>More likely, like Bjarne they didn&#x27;t notice that this program has Undefined Behaviour for some inputs and that in the real world it doesn&#x27;t quite do what&#x27;s advertised.
评论 #42956669 未加载
评论 #42989185 未加载
modernerd4 months ago
I haven&#x27;t read much from Bjarne but this is refreshingly self-aware and paints a hopeful path to standardize around &quot;the good parts&quot; of C++.<p>As a C++ newbie I just don&#x27;t understand the recommended path I&#x27;m supposed to follow, though. It seems to be a mix of &quot;a book of guidelines&quot; and &quot;a package that shows you how you should be using those guidelines via implementation of their principles&quot;.<p>After some digging it looks like the guidebook is the &quot;C++ Core Guidelines&quot;:<p><a href="https:&#x2F;&#x2F;isocpp.github.io&#x2F;CppCoreGuidelines&#x2F;CppCoreGuidelines" rel="nofollow">https:&#x2F;&#x2F;isocpp.github.io&#x2F;CppCoreGuidelines&#x2F;CppCoreGuidelines</a><p>And I&#x27;m supposed to read that and then:<p>&gt; use parts of the standard library and add a tiny library to make use of the guidelines convenient and efficient (the Guidelines Support Library, GSL).<p>Which seems to be this (at least Microsoft&#x27;s implementation):<p><a href="https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;GSL">https:&#x2F;&#x2F;github.com&#x2F;microsoft&#x2F;GSL</a><p>And I&#x27;m left wondering, is this just how C++ is? Can&#x27;t the language provide tooling for me to better adhere to its guidelines, bake in &quot;blessed&quot; features and deprecate what Bjarne calls, &quot;the use of low-level, inefficient, and error-prone features&quot;? I feel like these are tooling-level issues that compilers and linters and updated language versions could do more to solve.
评论 #42954410 未加载
评论 #42954261 未加载
评论 #42965463 未加载
评论 #42955567 未加载
nialv74 months ago
How does enforcing profiles per-translation unit make any sense? Some of these guarantees can only be enforced if assumptions are made about data&#x2F;references coming from other translation units.
评论 #42987489 未加载
hoc4 months ago
I definitely wouldn&#x27;t have used &quot;&lt;&lt;&quot; in an &quot;ad&quot; for C++ :)<p>(I must say that I was happy to see&#x2F;read that article, though)
DonHopkins4 months ago
Generalizing Overloading for C++2000<p>Bjarne Stroustrup, AT&amp;T Labs, Florham Park, NJ, USA<p>Abstract<p>This paper outlines the proposal for generalizing the overloading rules for Standard C++ that is expected to become part of the next revision of the standard. The focus is on general ideas rather than technical details (which can be found in AT&amp;T Labs Technical Report no. 42, April 1, 1998).<p><a href="https:&#x2F;&#x2F;www.stroustrup.com&#x2F;whitespace98.pdf" rel="nofollow">https:&#x2F;&#x2F;www.stroustrup.com&#x2F;whitespace98.pdf</a>
jjmarr4 months ago
Modules sound cool for compile time, but do they prevent duplicative template instantiations? Because that&#x27;s the real performance killer in my experience.
评论 #42953728 未加载
评论 #42954669 未加载
mempko4 months ago
Bjarne Stroustrup (the creator of C++) is the best language designer. Many language designers will create a language, work on it for a couple years, and then go and make another language. Stroustrup on the other hand has been methodically working on C++ and each year the language becomes better.
评论 #42987055 未加载
评论 #42987699 未加载
zie1ony4 months ago
Seeing badly formatted code snippets without color highlighting in article called &quot;21st Century C++&quot; somehow resonates with my opinion on how hard to write and to ready C++ still is after working with other laguages.
评论 #42988462 未加载
imron4 months ago
I want to love C++.<p>Over my career I’ve written hundreds of thousands of lines of it.<p>But keeping up with it is time consuming and more and more I find myself reaching for other languages.
评论 #42987813 未加载
评论 #42986880 未加载
评论 #42987064 未加载
评论 #42987077 未加载
评论 #42986906 未加载
评论 #42987082 未加载
评论 #42989516 未加载
评论 #42987353 未加载
评论 #42989552 未加载
评论 #42986978 未加载
crims0n4 months ago
For someone who wants to get into systems programming professionally, is C++ going to be a hard requirement or can one mostly get away with C&#x2F;Rust?
评论 #42956272 未加载
评论 #42955817 未加载
mempko4 months ago
That&#x27;s why C++ is still around today, it was built on some solid principles. Bjarne is such a good language designer because he never abandoned it. Lesser designers make a language and start another in 5 or 10 years. Bjarne saw the value in what he created and had a sense of responsibility to those using it to keep making it better and take their projects seriously.<p>Whenever I have an idea and I start a project, I start with C++ because I know if the idea works out, the project can grow and work 10 years later.
wiseowise4 months ago
I always hear about “import std” but still don’t see out of the support for it. Is it still experimental?
DidYaWipe4 months ago
Let us know when C++ gets rid of the mess that is header files.<p>Until then... YAWN.
评论 #42989828 未加载
ephaeton3 months ago
loving he goes &#x27;int main() { ... }&#x27; and never returns an int from it. Even better: without extra error &#x2F; warning flags the compiler will just eat this and generate some code from it, returning ... yeah. Your guess is probably better than mine.<p>If the uber-bean counter, herald of the language of bean counters demonstrate unwillingness to count beans, maybe the beans are better counted in another way.
评论 #42991940 未加载
评论 #42992881 未加载
justanotheratom4 months ago
C++ should be known for the amount of collective brain cycles wasted on arguing what subset of C++ is the right one to use.
评论 #42987538 未加载
pro144 months ago
is the job market for C++ developers still good?
评论 #42987720 未加载
AnonC4 months ago
Tangential question: is there a Rust equivalent for the book “The Design and Evolution of C++”?
评论 #42988615 未加载
ninetyninenine4 months ago
21st century C++? AKA Rust?
评论 #42988477 未加载
biohcacker844 months ago
After decades of C++ development, I prefer C, modern Fortran and Rust.
评论 #42987063 未加载
DidYaWipe4 months ago
Just reading the first 1&#x2F;5 of this made me bored. I started my career with C++, being heavy into it for 10 years. But I&#x27;ve been doing Swift for the last 10 at least. I had a job interview last week for a job that was heavy C++, with major reliance on templates and post-C++ 11... and it didn&#x27;t go well. You know what? I don&#x27;t give a shit.
评论 #42989286 未加载
9999000009994 months ago
C++ and C still force a usage of header files.<p>For whatever reason this is probably the biggest reason I&#x27;ve struggled with it( aside from tooling... Makes me miss npm).
mskcc4 months ago
Excellent article. Thanks for sharing.
atombender4 months ago
Previous from 3 days ago: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=42952720">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=42952720</a> (103 points, 85 comments)
评论 #42987761 未加载
Night_Thastus4 months ago
Something about the formatting of the code blocks used is all messed up for me. Seems to be independent on browser, happens in both Firefox and Chrome.
评论 #42953609 未加载
评论 #42953654 未加载
评论 #42954510 未加载
评论 #42953814 未加载
评论 #42956689 未加载
评论 #42953503 未加载
评论 #42953953 未加载
评论 #42953846 未加载
asplake4 months ago
<a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=42952720">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=42952720</a>
zygentoma4 months ago
Who the hell typeset this?
评论 #42986655 未加载
评论 #42950925 未加载
评论 #42986723 未加载
评论 #42986740 未加载
otteromkram4 months ago
I dislike the style of Code used to write this. I understand that, given who wrote the article, this is blasphemy.<p>Opening braces should be inline with the expression or definition.<p>Comments can be above what they&#x27;re referred to.<p>Combined, this makes any code snippet look like crap on mobile and almost impossible to follow as a result.