What to do with cpp:S4963 when destructor is mandatory

Hello @FlorentP42

Destructors are run in a deterministic manner in C++ but the order of element destruction in STL containers is not specified by the standard.

However, delete [] does delete objects in reverse order they were created. So depending on your implementation, the order for std::vector is fixed and appropriate for your use case. I would not advise relying on this implementation detail and instead creating a custom container class that handles destruction in the order you need. This helps keep classes smaller and abides by the single-responsibility principle (SRP), thus reducing maintenance burden and complexity.

In the same fashion, since you cannot use std::jthread, having a wrapper around std::thread that joins in its destructor helps follow the SRP. We link to a C++ Core Guildeline in C++ static code analysis: "std::jthread" should be used instead of "std::thread" that details this a bit more.

I missed this bit indeed. I would advise discussing with the owner of the repository to define a process to close these issues. If they want to give you permission to handle issues yourself, they can. See for example this thread which links to Managing user permissions in SonarCloud.

HTH