Просмотр исходного кода

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.
Lioncash 8 лет назад
Родитель
Сommit
10d2ab8098
2 измененных файлов с 4 добавлено и 0 удалено
  1. 2 0
      src/core/core.cpp
  2. 2 0
      src/core/core.h

+ 2 - 0
src/core/core.cpp

@@ -25,6 +25,8 @@ namespace Core {
 
 
 /*static*/ System System::s_instance;
 /*static*/ System System::s_instance;
 
 
+System::System() = default;
+
 System::~System() = default;
 System::~System() = default;
 
 
 /// Runs a CPU core while the system is powered on
 /// Runs a CPU core while the system is powered on

+ 2 - 0
src/core/core.h

@@ -168,6 +168,8 @@ public:
     }
     }
 
 
 private:
 private:
+    System();
+
     /// Returns the currently running CPU core
     /// Returns the currently running CPU core
     Cpu& CurrentCpuCore();
     Cpu& CurrentCpuCore();