Abandon C++ !

repoman0

Diamond Member
Jun 17, 2010
4,486
3,335
136
C and C++ shouldn’t even be grouped together at this point. Properly using standard library pointer wrappers alone such as unique and shared ptr in C++11 and later goes a very long way toward not writing memory error bugs. At this point in my work in real time robotics, if I see someone use a raw pointer or new or delete I will likely reject the PR until it is fixed.

I do want to learn Rust as well but modern C++ can be done right.
 

Red Squirrel

No Lifer
May 24, 2003
67,486
12,176
126
www.anyf.ca
It's not the language that determines security it's the actual code. You can write unsecure code in any language.

It's also weird that this is coming from the 5 eyes because they actually prefer stuff to be insecure as it makes their job easier.
 
  • Haha
Reactions: igor_kavinski

mv2devnull

Golden Member
Apr 13, 2010
1,500
145
106
That article ends with:
Bjarne Stroustrup, who created C++, said that proper programming practices can provide type and memory safety in "classic" languages, too. Stroustrup also noted that even Rust code can be written unsafely.
Then we can consider how Linus Torvalds has kept C++ out of Linux kernel, but Rust does have some support in recent kernels (in addition to C). C != C++
Fact is, one does not need much effort to write bad code in any language (and if one assumes that language "handles it" for you, then the likelyhood of mess goes up).
 

BFG10K

Lifer
Aug 14, 2000
22,709
2,977
126
Nobody will rewrite billions of lines of C code anytime soon, especially not in kernel, device driver, or embedded space.

We can already see the damage such rewrites cause in basic user space. Look how slow and bloated Windows UI, UWP apps, Visual Studio, Adobe Reader, Steam (etc) are because of their "rich UI experience." Absolutely horrendous memory consumption too.

Every version of VS gets slower to startup and open even simple projects. I switched from VS to Pelles C for my hobby projects and wow, what a difference. Looks and feels like a real Windows 95 program, the way things should be.

Consistent UI, lightweight, instantly launches and has no trouble keeping up with my keystrokes, unlike VS.

60MB install for the entire package vs multiple GB for a minimal install of VS. Also literally uses a thousand times less RAM than VS (3MB vs 3GB for my current 16 file C project).

You can tell it's probably written in itself as a native Win32 application, like the good old days.
 
Last edited:
  • Like
Reactions: igor_kavinski

Red Squirrel

No Lifer
May 24, 2003
67,486
12,176
126
www.anyf.ca
Could be a fun project to rewrite the entire Linux kernel in Java. :p

(I'm picturing Linux Torvalds showing me the middle finger just for suggesting that)
 
  • Haha
Reactions: Ken g6
Jul 27, 2020
16,592
10,582
106
Could be a fun project to rewrite the entire Linux kernel in Java. :p
Don't think Java can easily be compiled to native machine code. An OS written in Java would have to load the JVM at boot and it will freeze during garbage collection events. I'm sure it can be done but there would be undesirable side effects. Maybe ChatGPT can help? :p