For debugging purposes, you can add a special signature element to MyClass and set its value to a constant
class MyClass { public: MyClass() : signature(762347562374) {} bool isValidSignature() const { return signature==762347562374; } private: unsigned long long signature; <other members> };
Then check it as follows:
char *buffer = new char[sizeof(MyClass)];
You can put everything related to the signature inside the correct #ifdef , so that it only works in debug mode.
source share