• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

C++ vs Rust

Question: has anyone written an in-depth, "scientific" comparison of Rust and C++ at a level higher than "factional cheerleading" (no offence intended :-)?

I found blogs like this.



In particular, precise details (without the handwaving) on why, how and when to use or not use Rust, C++.
 
Last edited:
Developers use Rust for general programming, web development, data science and video gaming, as well as for augmented reality (AR), virtual reality (VR) and blockchain projects.

OK, any other applications?
 
Question: has anyone written an in-depth, "scientific" comparison of Rust and C++ at a level higher than "factional cheerleading" (no offence intended :)?

I found blogs like this.



In particular, precise details (without the handwaving) on why, how and when to use or not use Rust, C++.
This is hard to come by it seems and is why I initially came to QN with the question. As far I’ve seen, it’s mostly Rust advocates advocating for something new without really saying when/why it’s better. And in that case, I’d just stick to C++.
 
This is hard to come by it seems and is why I initially came to QN with the question. As far I’ve seen, it’s mostly Rust advocates advocating for something new without really saying when/why it’s better. And in that case, I’d just stick to C++.
I spent the last 3 days doing Rust programming for a bit of relaxation (am almost an expert by now :), but being my age means I'm a fast learner). I plan to spend a few more days to suss out more features. It is just a C++20 lookalike; if you know C++20 (and you do) then it is a piece of cake.

From Wiki

Rust is a multi-paradigm, general-purpose programming language that emphasizes performance, type safety, and concurrency. It enforces memory safety—meaning that all references point to valid memory—without a garbage collector. To simultaneously enforce memory safety and prevent data races, its "borrow checker" tracks the object lifetime of all references in a program during compilation.

Rust was influenced by ideas from functional programming, including immutability, higher-order functions, and algebraic data types. It is popular for systems programming.[13][14][15]

This is true, more or less. But talk is cheap.

Rust is a multi-paradigm, general-purpose programming language
Not in my book. Inside Rust is a (not very useful) protean Actor model trying to get out. It is not OOP, GP, FP, really. More later.

Who would like me to write a small precise report on Rust?

Caveat: my opinion of 2024-5-6.
@MichaelLewis
 
Last edited:
Would be nice to see you implement something a bit more complicated in Rust and compare and contrast it to the C++ implementation. Can be finance related, or whatever other topic you like.
Good idea. This week I'm just kicking the tyres (like uchi komi) and then I can go to a small app, e.g. Black Scholes (call C++/C maths function from Rust). yes??
Rust does not have much OOP support ..

Our goal is eventually interop.
 
Last edited:
Good idea. This week I'm just kicking the tyres (like uchi komi) and then I can go to a small app, e.g. Black Scholes (call C++/C maths function from Rust). yes??
Rust does not have much OOP support ..

Our goal is eventually interop.
Would be downright excellent!

Also some of the more popular/common software design patterns used.
 
Would be downright excellent!

Also some of the more popular/common software design patterns used.
In Volume II of book. This be Vol I.

1714949858920.png
 
Rust does not have much OOP support ..

Our goal is eventually interop.
That seems fairly limiting, don’t you think? OOP is really useful in a lot of cases. Makes it seem like it’d be difficult to build a trading system or pricing libraries, etc.

My day to day is probably 80% OOP and 20% functional.
 
Last edited:
Back
Top