avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: static class member as interrupt handler works, but not if class is


From: Russell Shaw
Subject: Re: static class member as interrupt handler works, but not if class is templated
Date: Sun, 11 Apr 2021 13:18:28 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]