|
From: | Anton Staaf |
Subject: | Re: static class member as interrupt handler works, but not if class is templated |
Date: | Sat, 10 Apr 2021 20:40:44 -0700 |
On 11/4/21 8:36 am, Trampas Stern wrote:
> Actually C++ is not slower or more bloat than C, depending on the features used.
>
> For example I do not use RTTI or exceptions, so that makes it about the same as
> C for size. Yes you have to turn these features off in your compiler (-fno-rtti,
> -fno-exceptions). Sure you have trampolines or jump tables for function
> overloading but you have to do the same in C. If you do not use inheritance or
> function overloading you do not have the penalty.
Function overloading is a compile-time concept, but the result after name scope
flattening are simple function names that are called without any extra pointer
indirections (ie, no different than C).
C++ is as efficient as C only if what is written translates to the equivalent
form. This is easy to do, but only after a large hurdle of understanding how C++
compilers work.
The biggest shortcoming in the C++ "industry" is that there is no literature i
have seen that explains in a compact way how you can look at a piece of C++ code
and see how it would translate to the equivalent assembly, which is the main
advantage of C.
[Prev in Thread] | Current Thread | [Next in Thread] |