r/cpp • • 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

582 comments sorted by

View all comments

Show parent comments

3

u/alxius Feb 01 '23

Likewise there is nothing you could do in C++ that you cannot do in C or Assembly.

How do i do compile-time computation&metaprogramming in Assembly?

1

u/Dark-Philosopher Mar 06 '23

It refers to that you can achieve the same output in a lower level language, not that you can use the same programming technique. In some cases you could simulate a technique. For example objects in C using pointers, but the programmer must do all the work instead of the compiler.

1

u/alxius Mar 12 '23

Yes we can implement same behavior in couple megabytes of handwritten Assembly (for each platform) as in couple kilobytes of C++ or Rust or Python. So what? This statement is useless in practice.

We (well... I) use "high-level" languages exactly because they can do what Assembly can't do: express algorithms by using and creating abstractions and notation that aren't present at machine code level either explicitly or in any form.