Not sure if that answers your question - but C is basically just cross-platform assembly. That was the original intention, and to this date, what you can do is mostly pointer manipulation/arithmetic. Structs for example are just a fancy way for doing pointer arithmetic.
This all means that C code is very deterministic, regarding behavior as well as timing. Well suited if you want as little abstraction from the hardware as possible.
Structs for example are just a fancy way for doing pointer arithmetic.
This all means that C code is very deterministic, regarding behavior as well as timing. Well suited if you want as little abstraction from the hardware as possible.
And C++ also has structs. :-)
So you can use the "little abstraction" when you build the hardware interface layer. Then you can add more abstractions when you build the next layer. You don't have to be close to the hardware all the way, all the time.
That was not the point. As C is a subset of C++, you can generally do everything in C++ that C would allow you.
However, C does not implement vtables for structs. And classes aren't just "a fancy way for doing pointer arithmetic". There's a lot more going on in the background.
1
u/simulacrasimulation_ Jul 13 '22
Aside from C not being object-oriented like C++, what are some of the more nuanced differences as to why one would choose C over C++ (and vice-versa)?