C++ object methods have a hidden pointer as an argument. Therefore there is no way to convert them to a C or ASM method directly.
Tricks:
Friend is a dirty way to do things. Generally speaking using interrupts directly with C++ objects is a sign of a larger problem. More than likely the abuse of OOP, async, maintenance/readability and/or hierarchical design.
Tricks:
- Static method (Internal to class, not using object)
- Singleton (External to class, using object)
- Friend function (External to class, using object)
Friend is a dirty way to do things. Generally speaking using interrupts directly with C++ objects is a sign of a larger problem. More than likely the abuse of OOP, async, maintenance/readability and/or hierarchical design.
- Friends makes your code impure
- Friends dissolves encapsulation and boundaries
- Friends makes your code non-reentrant
- Friends makes your code non-thread safe
- Friends allow spaghetti code
- Friends generally love diamonds
Statistics: Posted by dthacher — Sat Nov 23, 2024 6:11 pm