r/cpp
•
•
Nov 01 '24
•
1
Feds: Critical Software Must Drop C/C++ by 2026 or Face Risk
https://thenewstack.io/feds-critical-software-must-drop-c-c-by-2026-or-face-risk/
263
Upvotes
142
u/Mysterious_Focus6144 Nov 01 '24
The headline gave the impression that they're insisting on a complete rewrite of all existing software. That's not quite the case:
153
u/thingerish Nov 01 '24
I wonder what OS they are planning to use?
18
u/number_128 Nov 01 '24
Sorry in advance for this one sided rant..
People have warned against using C++ for a couple of years now.
We can point out that the people warning against C++ are stupid, we can show how their arguments are wrong.
The problem is that the warnings come from positions of power. Power to make people listen and even stronger power. So it is a big mistake not to take it seriously.
At CppCon this year, there was much excitement around reflection. I used to be excited about reflection, but not anymore. If I'm not allowed to use C++ anymore, I don't care if it has reflection.
We should drop everything, until we have a safe C++, then we can start adding reflection and other nice things. The 3 year release schedule has been a success, but we should even drop that, until we have fixed the safety issue.
We are very concerned with not breaking old code. Who cares if you can build old code on a new compiler if you're not even allowed to use that code.
Breaking changes will force everyone to make changes to their code in order to upgrade their code to the latest compiler. The alternative is to force everyone who is serious about their code to rewrite ALL their code to Rust. Many have already started this transition.
Python had a bad story upgrading from version 2 to 3. An important reason for this is that there was no reason to upgrade.
C++ developers are being told that they have to either upgrade or rewrite everything to Rust. We have a very strong reason.
Again, I'm sorry for this rant...
27
u/[deleted] Nov 01 '24
I'm becoming quite tired to see post like this in this community. If I ever want to know how much rust is great there is r/rustlang for that. Spoiler it is not and I'm quite tired of it, it is surely a good new impressive perspective but it seems to me like all AI things , just marketing. C/C++ have surely problems in statically check process, more than ever if you don't turn on all warnings. Safety is 90% accomplished by the design process of a software, 10% by the language itself.
40
u/joshbadams Nov 01 '24 edited Nov 01 '24
Misleading title. It implies some punishment if their recommendations aren’t followed. There is no binding law or punishment that I could see. (Edited for typos)
65
u/Artificial_Alex Nov 01 '24
For all the mistaken armchair warriors here, the article is talking about and links to the CISA/FBI "Product Security Bad Practices" guide. https://www.cisa.gov/resources-tools/resources/product-security-bad-practices?utm_source=the+new+stack&utm_medium=referral&utm_content=inline-mention&utm_campaign=tns+platform
This seems to be a very reasonable document (admittedly the memory safety thing is weird). But the other stuff is quite reasonable and if anyone's ever worked on admin system they'll know how many bad practices there are. This just seems to allow the Government to sue people for negligence (i.e. deflect the blame onto someone else because they didn't give a department enough funding to hire a sys admin, or alternatively; hold a corporation accountable for not hiring a competent sys admin.)
66
u/sanblch Nov 01 '24
Good luck with that
22
u/seba07 Nov 01 '24
When writing code for the automotive industry you are encouraged not to use any dynamic memory allocations and need to justify it if you want to use it. There is a very large list of requirements and guidelines. So something like this doesn't feel so uncommon.
167
u/1bithack Nov 01 '24
Does linux kernel count as critical software? Good luck rewriting it in 2 years.
47
u/James20k P2005R0 Nov 01 '24 edited Nov 01 '24
ITT: Nobody has read the article. They're suggesting no new critical software be written in C++, and that existing software must publish a memory safety roadmap
This is a completely reasonable stance
After 2026, if you choose to write new critical code in C++, its likely that documents like this will contribute to potential legal negligence if it causes harm, which is interesting. If you build a bridge out of materials that have been warned to be unsafe, you have more liability, and choosing to write a critical web service in C++ is now clearly a bad idea
Documents like this are a clear precursor to two things in my opinion:
This means that while ideally we'd be shipping memory safety in C++26, I'd guess that realistically we have until about C++29 to ship memory safety. This means that in the next, next standard, we really need to be shipping a complete memory safety solution
I don't think it'll happen, but after C++26 ships, the committee ideally needs to stop other work, and make full memory safety the big thing. Lets all spend 3 years arguing about it, and then ship it in 29. Nobody will be happy, but there's simply no more time to dilly dally
No more profiles, no more half assing this, lets collectively smooth out Safe C++ and ship it, because we need memory safety as a top priority
9
u/positivcheg Nov 01 '24
Meh, it’s only about software for national security of US.
6
u/LorcaBatan Nov 01 '24
I am from Europe and had recently job interview (C/C++ Embedded) to a US company having site here. The interview was with American managers that where completely unaware of this situation. That was really strange to me. The company is likely a provider to federal institutions.
3
u/[deleted] Nov 05 '24
Rust? Yuck.
27
u/scatraxx651 Nov 01 '24 edited Nov 01 '24
Very stupid
Maybe a much better idea is maybe to force all c/c++ software developers in critical software to use memory sanitizing or "safe" compiler settings with high warning levels available, you can write garbage in unsafe rust as well as c++.
But at the end of the day many applications inherently do unsafe operations (e.g. memory access in embedded systems) so I don't know how that would work.
7
u/usefulcat Nov 01 '24
The article (the contents, not just the title) has the flavor of clickbait.
This is merely a report which contains a set of recommendations. It might be phrased in such a way as to sound intimidating, but I don't see anything to indicate that there are any actual legal requirements here.
21
u/QuarterDefiant6132 Nov 01 '24
Oh yeah I'll just use unsafe blocks in rust and write the shittiest code humanity has ever produced out of spite
18
u/ImNoRickyBalboa Nov 01 '24
Except that most dangerous leaks and incidents have been things like log4j on presumed 'safe code's
These knob heads are so ignorant it hurts.
8
u/Rasie1 Nov 01 '24
Ah, the famous C/C++ language. It's where you pass around raw owning pointers and manually allocate memory like it's 1980
9
u/gleybak Nov 01 '24
After 2026 FBI will investigate your rust codebase for every ‘unsafe’ usage.
4
u/NervousSWE Nov 01 '24
Does the FBI have their own OS written in a memory safe language. Not being facetious, but if they don't is that also part of their security roadmap? Or do they just trust outside kernel developers to write secure code more than their own developers? (Which may also be reasonable). Although I suppose they can shore up as many possible security issues as possible, and if they feel memory safe languages are a must this is reasonable. It's not all or nothing.
7
u/InitRanger Nov 01 '24
If the federal government wants me to use something like Rust, then I am only going to use C++ out of spite.
5
u/CrzyWrldOfArthurRead Nov 01 '24
"Hey! Hey! I have asked you nicely not to use C++. You leave me no choice but to ask you nicely again."
5
u/t_hunger Nov 01 '24
C++23 gets published and then this paper. Looks like someone is not impressed by the latest and greatest C++.
I hope C++26 will be a leap forward, getting C++ of the naughty list, but I am notmholding my breath there.
3
u/[deleted] Nov 01 '24
I don’t know rust but is rust really that safe as claimed? Is there low level feature in rust that can directly manipulate memory and cause ub ?
3
u/JimHewes Nov 02 '24
There's a lot of software that's not critical.
4
u/Tamsta-273C Nov 01 '24
Which one? 98, 14, 20.....
Same as my uni who has C/C++ courses for years - it's not old C and it's not modern C++, rather the mix of some stuff from book professor wrote two decades ago.
4
u/Healthy-Educator-267 Nov 01 '24
Finally rustbros are gonna get some jobs
3
u/corysama Nov 01 '24
Ah.. But, we are C++ developers! Facing risk is what we do!
2
u/[deleted] Nov 01 '24
Or maybe just learn how to use the languages properly, modern C++ is unsafe only if you want it to be. If everything gets written in rust it does not solve all the problems, just open the doors for new ones like using
unsafekeyword2
u/pedersenk Nov 01 '24
I'm assuming this absurd article is sponsored by Rust lobbyists?
They really should better spend their time making their language actually feasible rather than wasting everyone elses time as well.
2
u/Mr-Nobody5000 Nov 02 '24
Isn't the LLVM that rust uses written in c++.
2
u/germandiago Nov 01 '24
C/C++ again...
2
u/wjrasmussen Nov 01 '24
I think we need to start with memory safe Operating Systems.
1
u/Grounds4TheSubstain Nov 01 '24
The fucking Rust lobby strikes again!
1
u/[deleted] Nov 04 '24
posts like this will scare new c++ devs into rust. As a new C++ dev, what are my options?
1
u/Aromatic_Chicken_863 Nov 09 '24
Did they just mix up memory and data leaks? Really, explain to me, how a memory leak can lead to a data leak and security problems?
Also, I know a lot of ways to make a memory leak in Java, Flutter or C#.
1
u/myvowndestiny Nov 09 '24
I am a sophomore computer science student . So should I continue learning c++ or not ?
1
u/0key0key May 21 '25
Late to this discussion. I can't image a world without C/C++, just look at AOSP (Android Open Source Project) source code, most is written in C++ and Java. Must that C++ code be dropped as well?
1
u/Competitive-Day199 Feb 25 '26
can't believe that 25 years after Code Red and nimda this is still being debated
1
u/01e9 Nov 01 '24
Just follow the guidelines and don't write old-style sh*t
0
u/OkMost726 Nov 01 '24
Feds are dumb as fuck
1
u/X-calibreX Nov 01 '24
So what is this all about exactly? Not using the stack for memory, not using pointer arithmetic?
1
u/RandomOnlinePerson99 Nov 02 '24
Goodby embedded stuff ...
-2
u/-1_0 Nov 01 '24
... CISA ... clowns
1
u/Superb-Tea-3174 Nov 04 '24
I like Rust but this seems ill-informed to me.
-2
u/arthxyz Nov 01 '24
It's funny how the US started to hate c++ when it became obvious that AI can't write proper c++ code...
-2
u/Kaisha001 Nov 01 '24
The 'feds' are morons, but I'd expect nothing less from the government.
0
u/ujustdontgetdubstep Nov 01 '24
Ya ok we'll get right on that mate
0
u/edparadox Nov 01 '24
Who write such papers?
0
u/easbarba Nov 01 '24
All of this advocacy stinks surveillance
-3
u/TbR78 Nov 01 '24
lol… maybe invest a bit more in teaching and education?
-4
u/[deleted] Nov 01 '24
that shit gov warnings increase my motivation to learn C++
-2
u/rentableshark Nov 02 '24 edited Nov 02 '24
Corrupt bureaucrats! I miss the days when language wars were solely prosecuted on usenet and mailing lists.
You can take my life, but you’ll never take my raw pointers.
Let the experts choose the right tools for the job. Java/C#/JS (maybe python) entirely appropriate for most use cases and that’s been clear long before that idiotic NSA paper first came out favouring MSLs. For everything ill suited to Java, C# & friends - there’s C and C++. Always space for alternatives for niche users (Haskell, rust, perl, asm etc) but the idea that all “compiled” code ought to be Rust or Swift is an abomination. Notwithstanding the narrower scope of the clickbait article, the regulatory direction of travel is plain to see. It’ll fail hard imo but lot’s likely to create a lot of unnecessary pain until the bromides figure out their regs are misguided.
-4
u/JohnDuffy78 Nov 01 '24
Great excuse to spend more money.
The year 2000 boogeyman was bonanza for the cobol programmers.
-1
u/wonderfulninja2 Nov 01 '24
SUS AF, simple as.
-4
u/DevaBol Nov 01 '24
Without government, who would harass people for using whichever software they like?
-2
u/[deleted] Nov 01 '24
How about 100 ways to get formatted time in C++