Live data from Hacker News

It's time to halt starting any new projects in C/C++

twitter.com

201–210 of 929 posts

Re: It's time to halt starting any new projects in C/C++

#201
post #107

Can you even use Rust for Windows GUI programming? Is it a practical choice at all for interfaces?

In theory yes, but there's a lot of quirks and limitations. The main issues are: - Rust string types assume UTF-8, but Windows generally uses double-byte Unicode encodings. The Windows string type isn't even UTF16, because it can include invalid code points. This means that at every API call there will be the overhead of converting the string encodings and having to "deal" with invalid strings somehow. - Rust compila…

I tried to spin up a project with the Microsoft Rust bindings but for what I needed (DirectX12) there’s a lot of necessary helpers in the header files that haven’t got ported over there. And working from one of the samples it was nowhere near as reliable as the C++ version. Beyond ‘oh the C++ code isn’t catching errors’ - every HRESULT was checked as it was using the WinRT bindings.

Kenny Kerr has done an excellent job with both the C++ and Rust bindings, but the Rust one isn’t there yet.

What I’d like to see is more use of a WinMD style metadata for the ABI for functions in DLLs you create. It would be quite simple to define a Span type that could then be imported and called safely from a diverse range of FFIs. I really shouldn’t be having to declare the ABI all over again with ctypes in Python.

Re: It's time to halt starting any new projects in C/C++

#202

I don’t feel that his opinion is all-encompassing. If Rust is being used in the name of security and reliability, then C/C++ should remain king of game development, where those two aren’t as important.

I've always wondered, why isn't it important here? Are security researchers just not looking? Especially for networked games.

Companies are definitely juicer targets, but I'm cynical enough to think that it's largely because it's not the game developers money that is at risk of being stolen, the incentives don't line up to encourage good security practices.

Re: It's time to halt starting any new projects in C/C++

#203

Someone else downthread: "young developers can pick up Rust quite fast, and that makes it vastly easier than trying to find talented C/C++ developers." I hope so. I have a hypothesis that the big-O for language success is "How easily can new programmers learn it?" Nothing else matter. JavaScript was slow, but everyone learned it, so it got fast. Python still had bad tooling, but everyone learned it, so it got better.…

Why not just hire good people and ask them to learn C++. I mean how the heck did anyone actually pass this magic barrier of becoming a "C++ dev" in order to get hired as a C++ dev?

Cause those person-hours have to come from somewhere.

Am I spending 2x of the new hire's time making them learn a harder language? Am I spending 2x of a senior's time teaching the new hire?

What's the payoff in sticking with C++? Better libraries? Better tools? IDEs? That stuff will all shift as time goes on, if popularity is against it.

Re: It's time to halt starting any new projects in C/C++

#204
post #148

Someone else downthread: "young developers can pick up Rust quite fast, and that makes it vastly easier than trying to find talented C/C++ developers." I hope so. I have a hypothesis that the big-O for language success is "How easily can new programmers learn it?" Nothing else matter. JavaScript was slow, but everyone learned it, so it got fast. Python still had bad tooling, but everyone learned it, so it got better.…

Are new devs less likely to screw things up in Rust? Probably. Is a modern Rust codebase easier to onboard with than a 40 year old monstrosity of a Microsoft C++ codebase? You bet! Are more people excited about learning Rust? Probably. Is rust much faster to learn than C++? Call me a skeptic. I've written Rust professionally and would rather write Rust than C++. That said, almost every concept you need to understand…

Well, our C++ codebase has a lot of threads that talk a lot, and buffers we'd rather not copy. Plus ad-hoc NIH versions of stuff that exists in Rust's stdlib, like mpsc, or ad-hoc NIH versions of popular crates, like for logging.

I sometimes just wish I could punt to Tokio. Why am I managing threads? Threads are an implementation detail!

I see it as, Rust tells you about the complexity and helps you with it. C++ waits until you trip on it, and then tells you to use Valgrind.

I could be wrong, though. Or I could be 5 years too early.

Re: It's time to halt starting any new projects in C/C++

#205
post #181

Earlier quoted context omitted.

What does this have to do with your grandparent comment?

It makes as much sense to talk about a language named "Haskell/Ocaml" as about "C/C++".

What other people are saying about it being a shorthand for similar languages, but also...

C/C++ is a coherent thing to write a single program in. You write some files with a .c extension and compile with gcc, some with c++ and compile with g++, and as long as you're careful in your header files everything works out just fine. People have actually done this, and because C isn't a subset you end up with C files that you can't compile as C++ and you really do have a heterogeneous project.

Haskell/Ocaml isn't comparable.

Re: It's time to halt starting any new projects in C/C++

#206
post #47

Calling him the Azure CTO is strictly accurate, but HN readers probably know Mark Russinovich better as one of the primary developers of sysinternals[1]. I bring that up to highlight the weight of his opinion: Russinovich is legendary in terms of his systems programming contributions. [1]: https://en.wikipedia.org/wiki/Sysinternals

absolutely! came here to say just that. also the excellent book "windows internals", which is kind of like the bsd red book, or the magic garden svr4 book, but for systems derived from the windows nt kernel. but perhaps his best work is this: https://learn.microsoft.com/en-us/sysinternals/downloads/blu... a screensaver that produces a realistic blue screen (kernel panic) for the version of the operating system and ke…

Also IMO it's best to avoid his fiction books, Zero Day etc. It's been about a decade since I read it, but it was the first book I've ever read where I felt uncomfortable with the level of detail the author went to when describing the breasts of every female character. The random awkward sex scenes thrown in for no reason was a weird choice.

Most importantly, there's also a complete lack of understanding of the underlying motivations behind both Islamic terror organizations, and cyber crime groups.

I love a ton of things that Mark has built, and I'm glad he's out living his best life. According to the Amazon reviews, a ton of people loved the book, but from my perspective Zero Day is a rare miss.

Re: It's time to halt starting any new projects in C/C++

#207

I think this title could be misinterpreted. There is a difference between Mark Russinovich saying this, as a personal opinion, and Mark Russinovich, Azure CTO, saying this as a company policy/directive. This tweet does not indicate that it's from him in his official capacity as Azure CTO.

I don't want to sound too girle or fanboyish but there is no other way to say it so I'll say it (hopefully he won't read this)- Mark Russinovich transcends titles and if he's said something about technology, it's probably 99.999% true. Also, RITF, I love Rust but remember zig exists so chill I also want to say one thing-- sometimes it's not so easy to just decide to write a project and say okay let me write this in R…

RITF? Research Institute of Tropical Forestry? Rat Intestinal Trefoil Factor?

Re: It's time to halt starting any new projects in C/C++

#208

Unless he means that Rust should be used on projects where the Rust compiler is available for all relevant platforms and C and C++ can be used otherwise, I disagree. In fact, until LLVM is replaced, C++ will probably be the language of choice for new languages. Even `rustc` requires a C++ bootstrap for that purpose. There are also other important C++ and C libraries that will continue to mean C and C++ may be better…

"Oh, and it's possible to make C as good as Rust", do you have some concrete advice documented somewhere? Thanks!

Probably write it in Rust first and make a direct C port based on it? (Or is there a tool do this automatically already?)

Re: It's time to halt starting any new projects in C/C++

#209

Earlier quoted context omitted.

Hm? I'm not a particular fan of Microsoft, but his stated opinion here is reflective of a broader trend in software design, one that's coming from both companies and the open source community. I don't see the brainwashing.

His "opinion" is not only reflective, but amplifying, and that's the scary part. The companies are the ones pushing this "security" stuff, because they want to stop us from doing things like jailbreaking --- and eventually running any software they don't approve of. See https://news.ycombinator.com/item?id=32905587 He used to write very useful utilities which did things that Microsoft didn't officially support or oth…

Perhaps his years of experience in the space have given him some perspective that leads him to a position other than the one we might have inferred from his previous work.

I can tell you the way I felt about security and open architectures at 25 is very different from the way I feel about them now.

Re: It's time to halt starting any new projects in C/C++

#210

Someone else downthread: "young developers can pick up Rust quite fast, and that makes it vastly easier than trying to find talented C/C++ developers." I hope so. I have a hypothesis that the big-O for language success is "How easily can new programmers learn it?" Nothing else matter. JavaScript was slow, but everyone learned it, so it got fast. Python still had bad tooling, but everyone learned it, so it got better.…

Why not just hire good people and ask them to learn C++. I mean how the heck did anyone actually pass this magic barrier of becoming a "C++ dev" in order to get hired as a C++ dev?

Because “just hire good people” is on par with “just hire good pilots”. Easier said than done.
Post reply on HN