Live data from Hacker News

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

twitter.com

611–620 of 929 posts

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

#611
post #223

Earlier quoted context omitted.

That's my take too. Idiomatic Rust is "safe" in the sense that... it disallows most nontrivial data structures. Even a doubly-linked list is impossible to get through the borrow checker. That's... not really that fatal. There's a lot of very useful code that can be written using only runtime-provided[1] containers and straightforward ownership trees. But obviously the big problem is that for applications that do need…

Random question, doesn't this then defeat the whole purpose of using rust? Memory errors, that is, pointer issues are the primary source of errors that ownership in rust claims to fix. If the only way you can make nontrivial data structures is use "a ton of unsafe blocks," then you'll still likely get the memory errors, only now it's in an unsafe block...so, now everyone can just blame the unsafe block? This reminds…

> doesn't this then defeat the whole purpose of using rust?

No because in practice you only need unsafe a tiny minority of the time, whereas C++ is always unsafe.

Most programmers do not spend most of their time writing low-level cyclic data structure libraries. If they did, then indeed some of Rust’s advantages would be mitigated.

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

#612
post #12

How much support does Microsoft give to the Rust Foundation (financial and otherwise)? Does Visual Studio (not VS Code) support Rust programming? Are there plans for an official Rust SDK for Azure? https://github.com/Azure/azure-sdk-for-rust

Why does Visual Studio need to support Rust when VS Code has amazing Rust support?

Never underestimate the power of creating UIs with a drag and drop editor. Command line tools for general users ended in the 80’s.

As far as I know, creating and dealing with UIs in Rust is a pain.

I’m waiting for MS Visual Rust.

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

#613

I am still ok with plain and simple C for cross-CPU code, for now. c++ is lost in grotesque and absurd complexity (that's why gcc move to c++ was one of the biggest mistake in software, ever). I am one of the guys who would like RISC-V to be successful, then "port" everything to RISC-V assembly, without excessive usage of the macro pre-processor, then forget about compilers. Linus T. (more likely the guys pulling the…

I don’t know what you mean by strings embedded in Rust syntax nor package management (unless you mean crates and modules, which are basically just namespaces; the only “package management” is done by higher-level tools like Cargo). To answer your other questions: no, Rust has neither garbage collection, nor templates. I don’t know what you mean by hardcoded weird and expansive memory allocation model; Rust’s is basic…

It was crates and modules, ok then it was weird namespace system. But I clearly remember "strings" being hardcoded in the syntax.

So you mean rust has grotesque and absurd object orientation like c++ (or java)? Please, say no.

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

#614
post #12

How much support does Microsoft give to the Rust Foundation (financial and otherwise)? Does Visual Studio (not VS Code) support Rust programming? Are there plans for an official Rust SDK for Azure? https://github.com/Azure/azure-sdk-for-rust

Why does Visual Studio need to support Rust when VS Code has amazing Rust support?

>> Why does Visual Studio need to support Rust when VS Code has amazing Rust support?

It's about 'skin in the game' and dog-fooding. If Microsoft is serious about Rust, they will use it internally and support it officially.

It's easy to give an opinion on Twitter about how everyone should use Rust and stop using C / C++ for new projects.

Officially supporting Rust in your enterprise software development tools and SDKs shows that you are serious and committed to what you say.

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

#615
post #223
post #211

I tried Rust about five years ago and I had trouble expressing cyclic data structures because there is no clear "owner" in a cyclic data structure. The "safe" solution recommended by the rustaceans was to use integers as references to the data in a vec or hashmap. I was rather put off by this: Instead of juggling pointers I was juggling integers. It made the code harder to debug and find logic errors. At least when I…

That's my take too. Idiomatic Rust is "safe" in the sense that... it disallows most nontrivial data structures. Even a doubly-linked list is impossible to get through the borrow checker. That's... not really that fatal. There's a lot of very useful code that can be written using only runtime-provided[1] containers and straightforward ownership trees. But obviously the big problem is that for applications that do need…

Modern C++ happily introduces nightmare bugs. Banning "new" from your codebase does not prevent problems.

You can still happily have UAF through references. The adoption of string_view has made this super clear. Arithmetic is still very error prone, with confusing promotion rules and little protection for overflows. Pointer arithmetic is still common - yes even if are using typical containers. What do you think is happening underneath the hood when you increment an iterator? Oh, and iterator invalidation remains a fun way of ending up with unsafe code even if everything looks totally fine.

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

#616

Would Rust be able to replace C++ in HFT?

If you want the lowest software latency as in "latency arbitrage", then probably not. However, even in HFT industry, there are a lot of software that you want very low latency but would still trade a bit latency in exchange for much better productivity, maintainability, and especially robustness provided by the type system of Rust. You want to be fast, and also want to reduce the possibility of hitting a company-brea…

Not much would have saved Knight Capital and powerpeg. You can write company bankrupting code in any language.

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

#617

Earlier quoted context omitted.

I don’t know what you mean by strings embedded in Rust syntax nor package management (unless you mean crates and modules, which are basically just namespaces; the only “package management” is done by higher-level tools like Cargo). To answer your other questions: no, Rust has neither garbage collection, nor templates. I don’t know what you mean by hardcoded weird and expansive memory allocation model; Rust’s is basic…

It was crates and modules, ok then it was weird namespace system. But I clearly remember "strings" being hardcoded in the syntax. So you mean rust has grotesque and absurd object orientation like c++ (or java)? Please, say no.

No, it doesn’t.

Why don’t you take the time to read a Rust tutorial rather than just assuming everything bad you can imagine about it and asking people to correct you?

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

#618
I've just trying to remember all the times i've heard this in relation to other languages replacing C/C++. I'd say java and C# are definitely in this category, but also python, go and probably swift too.

So I can now add rust to this list.

It's also interesting to see this as a tweet, avoiding any worry about the nuance of the problem domain, the experience of the developers, or what problems they encounter. Sure, rust is safer than C++, but is this important to the project you work on? What sort of problems do you encounter? Would rust help? What problems would it introduce?

Anyhow, 'rust is the new C++'. I wonder what the calling cry will be in 5 years time.

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

#619
post #402

Earlier quoted context omitted.

You don't need to know about about 6 different string types, arcane borrow checker workarounds, RefCell complexity, massive async cruft - acquired by Rust in just 2 years. C++ will still be used heavily when Rust is buried 6 feet under and HN moves to the next hype language.

> 6 different string types have fun living your life pretending all strings are of the same type. spoiler alert: it's the wrong kind of fun. it's a bit easier if you're from a native English speaking country, but only until you get blown up by utf-8 (if you're lucky) in production.

A fun example (https://www.youtube.com/watch?v=-7ebQqzGRKE) of the opposite happening, where C++'s silently different handling of various sorts of strings causes a bug.

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

#620
post #469
post #297

Earlier quoted context omitted.

This world - the one you exist in right now. I say that as someone that wrote C++ for 10 years before moving to Rust. Rust was by far easier. That said - that’s an extremely biased statement and I recognize that. I think it was largely the compiler that helped make it easier.

I'd argue that your parent is right. In the superficial sense, of learn the syntax and can spit out code. That said code in C++ would just vomit cryptic messages about templates and SEGFAULT nearly all the time. What I'm trying to say skill floor - minimum skill/time needed to learn something to do it however in Rust is higher than C++. Although not in the sense of you must be this smart to enter, but you need this m…

Speaking as someone for whom programming is only ancillary to my job and who previously use python as my primary language, I wouldn't touch C/C++ with a 10-foot pole simply because I don't trust my own abilities to not screw it up and don't have the time to put into learning them to a level where I know I'm not.

Things that Rust does that makes things easy for me as a less-experienced non-systems programmer:

- very good documentation and compiler errors

- cargo makes dependency management and distribution a breeze (big plus over python)

- footguns are easily recognizable and avoided (unsafe)

- strong typing allows me to express more invariants in the type system which makes my code easier to reason about (another big plus over python)

The borrow checker can be an impediment at times and I'm probably leaving some performance at the door by generally avoiding references in data structures. I've found that this is less of a problem over time. It can also be way more verbose. But I have way more confidence that things will work at the end of the day, which makes it worthwhile for me, even if on the surface it is take longer and be harder to write than python.

Post reply on HN