I think C++ is still a desirable coding platform compared to Rust
lucisqr.substack.com
I think C++ is still a desirable coding platform compared to Rust
1–10 of 110 posts
Re: I think C++ is still a desirable coding platform compared to Rust
#2Re: I think C++ is still a desirable coding platform compared to Rust
#31. How many years of C++ programming do you have under your belt? How many years of Rust?
2. For new work projects, do you choose C++ or Rust? Why?
3. For new hobby projects, do you choose C++ or Rust? Why?
4. Is there something about C++ that you wish Rust had?
5. Is there something nice about Rust (apart from the borrow checker) that you wish C++ had?
Re: I think C++ is still a desirable coding platform compared to Rust
#4I do see that peoples experience with C++ varies wildly, because shops either don't understand why modern C++ exists or they don't care. Either way, predictably, their software suffers and they will routinely run into segfaults. C++ obviously isn't perfect. It's an old language, and while it's trying to reinvent itself it will take some time.
If you ask me though, I don't give a rats ass about the safety things. My $dayjob is a big infrastructure product written in C, which practically never crashes because of memory problems. It just doesn't happen because of extreme discipline. Asserts when entering. Asserts when leaving. Magic values in structs. Sanitizers, clang-tidy, coverage, custom test frameworks, fuzzing. We have it all. And it's C! I understand newbies do better with Rust than C++. It makes a lot of sense. Still, I think that people use Rust more because it's easy to add dependencies, because it has 1 (one) build system, and because of that it's easy to build larger projects because of this. CMake has made good strides recently, but it needs to become the build system for C and C++, and we need global repositories to match Rust. Will that ever happen?
Re: I think C++ is still a desirable coding platform compared to Rust
#5I agree. I'm using it both in the game server, the client and for scripting! So far I haven't really had any serious problems that would be related to unsafety. You just have to be disciplined. Source: https://medium.com/@fwsgonzo/using-c-as-a-scripting-language... I do see that peoples experience with C++ varies wildly, because shops either don't understand why modern C++ exists or they don't care. Either way, predi…
Re: I think C++ is still a desirable coding platform compared to Rust
#6I agree. I'm using it both in the game server, the client and for scripting! So far I haven't really had any serious problems that would be related to unsafety. You just have to be disciplined. Source: https://medium.com/@fwsgonzo/using-c-as-a-scripting-language... I do see that peoples experience with C++ varies wildly, because shops either don't understand why modern C++ exists or they don't care. Either way, predi…
If openssl and skia would switch [to cmake], we'd be on our way.
Re: I think C++ is still a desirable coding platform compared to Rust
#71. Add two signed 64-bit integers without overflowing on either side (negative or positive) and without using 128-bit integers. If the sum is going to overflow, generate an error. If the sum is not going to overflow, evaluate the sum.
2. Multiply two signed 64-bit integers without overflowing on either side (negative or positive) and without using 128-bit integers. If the product is going to overflow, generate an error. If the product is not going to overflow, evaluate the product.
Essentially under no circumstance evaluate something that might overflow. Detect the overflow and generate error. Evaluate only if the detection algorithm says there is not going to be overflow.
We can't use 128-bit integers ecause some hardware may not have a 128-bit registers. It's probably possible to solve these but it gets complex pretty soon once you begin handling all the failure modes.
Does Rust make this kind of problems easy to be solved?
Re: I think C++ is still a desirable coding platform compared to Rust
#8Well that's pointless.
Re: I think C++ is still a desirable coding platform compared to Rust
#9I agree. I'm using it both in the game server, the client and for scripting! So far I haven't really had any serious problems that would be related to unsafety. You just have to be disciplined. Source: https://medium.com/@fwsgonzo/using-c-as-a-scripting-language... I do see that peoples experience with C++ varies wildly, because shops either don't understand why modern C++ exists or they don't care. Either way, predi…
Re: I think C++ is still a desirable coding platform compared to Rust
#10I've done some C++ but no Rust. I'd like to learn a few things from people who have done both. 1. How many years of C++ programming do you have under your belt? How many years of Rust? 2. For new work projects, do you choose C++ or Rust? Why? 3. For new hobby projects, do you choose C++ or Rust? Why? 4. Is there something about C++ that you wish Rust had? 5. Is there something nice about Rust (apart from the borrow c…
1. 10-20 years of C++ depending on your definition. But used C++ part-time casually/open-source from mid-90s to 2012 or so, and then mostly full-time from that point on @ Google, with a big chunk of that working in the Chromium source tree.
2ish years Rust, including the last year or so fulltime professionally.
2. Rust. Because of the more expressive type system, simplified/cleaner tooling, consistent syntax and style. The safety features are nice, too. C++ projects at work tend to get wrapped in Rust for the project I work on.
3. Rust. Same reasons as above.
4. C++'s const generics and constexpr support is much richer and better than Rust's. Placement new and custom allocator support in the STL has no answer in Rust yet, and the efforts to fix that (allocator_api etc) seem terminally stalled. Same with really good cross platform simd library support. C++ has a better story generally on embedded devices still, in terms of sheer # of toolchains.
5. I am not sure why people are focused on the borrow checker and safety as somehow the only distinguishing feature -- it's really not. C++ is missing a whole boatload of things from Rust, but most notably would be ADTs/sum types/pattern matching. This is the "secret weapon" of all languages inspired by the ML-series functional languages (StandardML, OCaml, etc.) and something C++ has no real answer for, though you can "sort of" approximate it with some template metaprogramming wanking I guess. Rust doesn't do this as well as ML or Haskell or F# or Scala because it confines it to its enums, but it's still really lovely and makes programs far more expressive and readable.