Liste des Groupes | Revenir à cl c |
Am 28.08.2024 um 13:09 schrieb Thiago Adams:C++ generates a lot of code, including constructors, destructors, and virtual functions.
There is often confusion between abstraction and the syntax used to achieve abstraction. Since there isn't a specific term for this, I'll refer to it as "syntax for abstraction."The distinction is that with abstraction you have not much code but
a big effect. Take f.e. a dynamic_cast<> which does a downcast. What
the dynamic_cast<> does is simple, but compared to C it generates a
lot of code.
But this is nothing we can't live with, with the befit of disallowing other unwanted C++ features.In C, we have everything we need: "data" and "functions."In C you have five to ten times the code and mostly boilerplat-code
to do the same thing.
If you mean code written by other people, then this is about a big "framework".For example, we can create an abstraction for a Matrix. Ultimately, the Matrix abstraction is represented by struct and the operations on it are functions:In C++23 you can have a matrix class and a multidimensional array
>
>
struct matrix a = {};
struct matrix b = {};
...
struct matrix c = matrix_mult(&a, &b);
-operator. This would result in the same code but much less effort.
Les messages affichés proviennent d'usenet.