wbenny / hvpp

hvpp is a lightweight Intel x64/VT-x hypervisor written in C++ focused primarily on virtualization of already running operating system
MIT License
1.12k stars 221 forks source link

Get rid of initialize() and destroy() method #11

Closed wbenny closed 6 years ago

wbenny commented 6 years ago

These methods should be replaced with constructors/destructors. Since constructors may fail - and using exceptions isn't very much of an option - error code should be checked via some special function "is_initialized() ?" after each created instance.

wbenny commented 6 years ago

After bit of a thinking, this solution wouldn't have any benefit. Currently, user has to make sure that overloaded initialize()/destroy() method calls the same method from the base class. After this fix user would still need to call extra function to be sure if ctor has been successful. Apart from that, some namespaces would still be needed to be initialized/destroyed by initialize()/destroy() method. It would bring nothing but ugliness.