C++ vs Rust - Impl vs Dyn - Arm vs x86

Ғылым және технология

Comparing C++ vs Rust - Static vs Dynamic dispatch. I will be explaining Assembly ARM64 and X86.
See code: github.com/sadhbh-c0d3/exampl...
Chapters:
00:00 Welcome
00:35 1.1. C++ Functions
03:35 1.2. C++ Structs
04:30 1.3. C++ Virtual Methods
12:12 1.4. C++ Concepts I
15:52 1.5. C++ Concepts II
18:45 1.6. C++ Concepts III
23:49 2.1. Rust: Functions
24:28 2.2. Rust: Structs
25:06 2.3. Rust: Traits I
28:38 2.4. Rust: Traits II
29:50 2.4.1 Rust: Impl
31:50 2.4.2 Rust: Dyn
36:08 3. Final Words
37:23 3.1 Thank you

Пікірлер: 13

  • @rochacbruno
    @rochacbruno25 күн бұрын

    Zero Cost Abstractions - Awesome video, thanks!

  • @jose6183
    @jose618323 күн бұрын

    That was amazing. A lot of C/C++ engineering is basically compiler hacking. Thanks for the video!

  • @soniakolasinska3850
    @soniakolasinska385024 күн бұрын

    This is educational video. You can get some grasp of assembly, get better understanding how your code in C++ or Rust translates into what computer will do with it. You can compare how ARM64 assembly differs from X86. You can learn how to do static polymorphism in C++. You can learn the difference between impl and dyn keyword in Rust. For your information the comments are actively reviewed and moderated. Thank you for taking time and watching my video. I hope you found it interesting and useful.

  • @mdvvvv
    @mdvvvv16 күн бұрын

    What about using C++ constexpr which would result in the same assembly generated as compile time eval is on by default on rust?

  • @amaama4140
    @amaama414016 күн бұрын

    Great video, Thanks! By the way, you could use something like `if constexpr (sizeof...(x) > 0) ` to get rid of terminator function at 17:00

  • @d1namis
    @d1namis25 күн бұрын

    thank you for video, it was helpful

  • @loanselot325
    @loanselot32516 күн бұрын

    C++ does not have compile time evaluation on (constexpr and consteval) by default unlike Rust, constexpr functions in C++ produce almost same assembly output as Rust

  • @soniakolasinska3850

    @soniakolasinska3850

    16 күн бұрын

    Constexpr doesn't mean compile time evaluated. It means that expression does not depend on volatile state, and that is the reason compiler may evaluate it at compile time. I'm not entirely sure if every constexpr is evaluated at compile-time. Cit: constexpr - specifies that the value of a variable or function can appear in constant expressions Are all constant expressions guaranteed to be evaluated at compile-time?

  • @soniakolasinska3850

    @soniakolasinska3850

    16 күн бұрын

    Rust is basically syntactic sugar for C++ templates and concepts in my eyes, and that is why I like Rust. Saying so I prefer to use C++, and that is because I prefer to define those templates and concepts, even if syntax more involved. C++ gives me raw power, while Rust gives me a subset of that was blessed by Mozilla Foundation. On the other hand, at Mozilla they do fantastic job writing C++ code. Have you ever worked with Firefox codebase? I worked with it, and I say it's beautiful.

  • @loanselot325

    @loanselot325

    15 күн бұрын

    @soniakolasinska3850 constexpr is a gray line between compile time and runtime, if the compiler can catch an optimization pattern, it will evaluate it on compile time. There is also consteval which is guaranteed to be evaluated at compile time, and forces programmer to write compile time code so constexpr fits better for the C++ examples you've given

  • @loanselot325

    @loanselot325

    15 күн бұрын

    @soniakolasinska3850 firefox codebase is amazing, unfortunately i am not that indepth with it, but i try to follow their rules on writing C++ code been messing with Vulkan and real time rendering :)

  • @ThePeri4n
    @ThePeri4n24 күн бұрын

    Awesome video!!!!!

  • @CODEDSTUDIO
    @CODEDSTUDIO26 күн бұрын

    👍

Келесі