MENU

Fun & Interesting

From C ➡️ C++ ➡️ Rust

code_report 176,170 lượt xem 2 years ago
Video Not Working? Fix It Now

In this video, I refactor a C function to C++ and then to Rust. I also show the equivalent Haskell code and show a comparison of number of assembly instructions generated at the end.

Links:
CodeAesthetic Video: https://youtu.be/CFRhGnuXG-4
Slides and Code: https://github.com/codereport/Content/tree/main/Talks/2022-12-YouTube/FromCtoCpptoRust
Godbolt Links: https://github.com/codereport/Content/blob/main/Talks/2022-12-YouTube/FromCtoCpptoRust/Summary.md
Behind the scenes video: https://www.youtube.com/watch?v=Vh3y1ela-_s

Chapters:
0:00 Intro
0:25 Motivation
1:19 C Code
2:10 C++ Code 1
2:43 C++ Code 2 - Reformatting
2:53: C++ Code 3 - views::iota
3:36 C++ Code 4 - views::filter
4:14 C++ Code 5 - std::accumulate
5:10 C++ Code 6 - ranges::accumulate
5:54 C++ Code 7 - Ternary Operator
6:50 Rust Code
8:30 Bug in C/C++ Code?
10:23 Haskell Code
11:30 Count of Generated Assembly Instructions Comparison
13:40 Outro

Follow me on Github: https://github.com/codereport
Follow me on Twitter: https://twitter.com/code_report
Follow me on LinkedIn: https://www.linkedin.com/company/codereport/

Comment