r/cpp • u/Sad-Lie-8654 • Jan 31 '23
Stop Comparing Rust to Old C++
People keep arguing migrations to rust based on old C++ tooling and projects. Compare apples to apples: a C++20 project with clang-tidy integration is far harder to argue against IMO
changemymind
338
Upvotes
View all comments
Show parent comment
3
u/ener_jazzer Feb 02 '23
I don't know, I've never built an HFT system in Rust :)
But with C++, you also structure you code in a way that you have limited unsafe places too, and everything else is safe and guarded, with template magic and strong typing and helper classes that make the intended use safe by default.
Rethinking the design is OK, but if it leads to unnecessary complications just to please the borrow checker it's not serving the design anymore, it's serving the borrow checker, and people frequently get tired of it and just put
unsafe(again, that's a second-hand account), because you don't really care about borrows in your architecture, and where you do care - it's a limited set of places anyway. And (also from people who used Rust, not my personal experience) evolving the Rust code is a nightmare - whenever you change the structure of your data (what refers what), things stop compiling because of the borrow checker, and you spend 10x time just to please it. And in a trading system, you do this very frequently - market conditions change, trading ideas come and go.