[gtkmm/gtkmm-3-24] tests/builder: Default-init members at declaration
- From: Daniel Boles <dboles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm/gtkmm-3-24] tests/builder: Default-init members at declaration
- Date: Sun, 24 Nov 2019 17:36:16 +0000 (UTC)
commit 5fc879cc6e608a0d31a70f672033450a99723df5
Author: Daniel Boles <dboles src gmail com>
Date: Sun Nov 24 14:02:30 2019 +0000
tests/builder: Default-init members at declaration
as that is safer than having to remember to default-construct pointers
in every constructor overload—& getting undefined behaviour if we don’t.
tests/builder/main.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/tests/builder/main.cc b/tests/builder/main.cc
index 302562d4..3c35c952 100644
--- a/tests/builder/main.cc
+++ b/tests/builder/main.cc
@@ -114,7 +114,7 @@ class MainWindow : public Gtk::Window
{
public:
MainWindow(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& refBuilder)
- : Gtk::Window(cobject), m_pDerivedButton(nullptr), m_pStandardButton(nullptr)
+ : Gtk::Window(cobject)
{
std::cout << "MainWindow::ctor" << std::endl;
@@ -136,8 +136,8 @@ public:
const Gtk::Button* get_standard_button() const { return m_pStandardButton; }
private:
- DerivedButton* m_pDerivedButton;
- Gtk::Button* m_pStandardButton;
+ DerivedButton* m_pDerivedButton = nullptr;
+ Gtk::Button* m_pStandardButton = nullptr;
};
} // end of anonymous namespace
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]