Quantum Leaps - 2023-12-07

The destructor declarations for various QP classes have been added in the latest QP/C++ 7.3.1. But all these declarations are disabled by default and require providing the macro Q_XTOR. The reason is that the presence of (virtual) destructors pulls in the delete operator from the library. This in turn, pulls in free() as well as malloc() and other functions highly undesirable in most high reliability embedded software.

Please note that only some of these destructors are actually defined in QP/C++, so if the destructors are enabled (by defining the macro Q_XTOR), the destructors for the following classes must be provided in the application (of course, you might use the destructor you proposed for ~QTimeEvt()):

#ifdef Q_XTOR
QP::QTimeEvt::~QTimeEvt() {...}
QP::QEQueue::~QEQueue() {...}
QP::QMPool::~QMPool() {...}
#endif

Finally, I would caution against tests that rely on cleanup from the previous tests, especially in C++ because the constructors of static objects don't run. Alarming number of tests pass only because of inadvertent side effects of preceeding tests. This provides a false sense of security and is highly counterproductive. The only truly reliable tests are those that immediately follow a clean system reset. This is precisely how QUTest unit testing harness is designed.

--MMS

 

Last edit: Quantum Leaps 2023-12-07