From 10d2ab80989e1362fe9cc206e0708d7aeeda5d3a Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 18 Jul 2018 18:15:16 -0400 Subject: [PATCH] core: Make System's default constructor private This makes it a compilation error to construct additional instances of the System class directly, preventing accidental wasteful constructions over and over. --- src/core/core.cpp | 2 ++ src/core/core.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/core/core.cpp b/src/core/core.cpp index 7936c5b56..ae3849a36 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -25,6 +25,8 @@ namespace Core { /*static*/ System System::s_instance; +System::System() = default; + System::~System() = default; /// Runs a CPU core while the system is powered on diff --git a/src/core/core.h b/src/core/core.h index f90f085ad..c6f69f001 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -168,6 +168,8 @@ public: } private: + System(); + /// Returns the currently running CPU core Cpu& CurrentCpuCore();