Skip to content

Commit

Permalink
Add virtual destructor (#12)
Browse files Browse the repository at this point in the history
The Bmi base class definition needs to define its destructor as `virtual` to enable derived classes to support accurate destruction.

Cf https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rh-dtor

This is technically an ABI change impacting any existing code. To avoid potential failures and definite UB from ODR violation, all clients and implementations within a given system will need to be (re-) built against matching versions of this header.

It's unclear whether it's a breaking change of the BMI specification itself. The depends on whether the reference to this file is normative or exemplary.
  • Loading branch information
PhilMiller committed Jun 6, 2024
1 parent 2037cf8 commit 7c9a1d0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bmi.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ namespace bmi {

class Bmi {
public:
virtual ~Bmi() { }

// Model control functions.
virtual void Initialize(std::string config_file) = 0;
virtual void Update() = 0;
Expand Down

0 comments on commit 7c9a1d0

Please sign in to comment.