lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 3733a87 4/5: Write explicitly-defaulted dtor


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 3733a87 4/5: Write explicitly-defaulted dtor inline, in class defn
Date: Mon, 6 Mar 2017 07:24:18 -0500 (EST)

branch: master
commit 3733a872feaa691ca140af3df6d48e34fe808fe8
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Write explicitly-defaulted dtor inline, in class defn
    
    In this discussion:
      http://lists.nongnu.org/archive/html/lmi/2017-03/msg00014.html
    we decided to retain a framework for distinguishing the [de]allocation
    of wx objects, because
    | it clearly indicates those "new"s that must not be matched by
    | "delete"s and allows us to distinguish them from all the others
    
    This commit, OTOH, has undone a deliberate prior decision that had the
    same original motivation (eliminating mpatrol diagnostics). This is
    not inconsistent with the above decision: although the original reason
    was incidentally similar, the motivation for maintaining separate wx
    allocations today does not apply here--we certainly do not write
      GetOpt* options = new GetOpt(...);
---
 getopt.cpp | 2 --
 getopt.hpp | 7 +++----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/getopt.cpp b/getopt.cpp
index 0d8de74..c5b4370 100644
--- a/getopt.cpp
+++ b/getopt.cpp
@@ -162,8 +162,6 @@ GetOpt::GetOpt(int argc, char** argv, char const* optstring,
     Initialize(noptstring);
 }
 
-GetOpt::~GetOpt() = default;
-
 void
 GetOpt::Initialize(std::string const& a_optstring)
 {
diff --git a/getopt.hpp b/getopt.hpp
index 2124883..b549f07 100644
--- a/getopt.hpp
+++ b/getopt.hpp
@@ -315,10 +315,9 @@ class LMI_SO GetOpt
     GetOpt(int argc, char** argv, char const* optstring);
     GetOpt(int argc, char** argv, char const* optstring,
             Option const* longopts, int* longind, int long_only);
-    // Write a non-inline dtor explicitly, to prevent an ostensible
-    // problem detected by a malloc debugger when memory allocated on
-    // one side of a shared-library boundary is freed on the other.
-    ~GetOpt(); // Added by GWC.
+
+    ~GetOpt() = default; // Added by GWC.
+
     int operator()();
 
     // first_char returns the first character of the argument.



reply via email to

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