ENH: ensure nullObject is large enough for reinterpret

- previously occupied 1 byte. Now occupies enough to hold a pointer,
  which helps if using reinterpret_cast to something that has some
  member content.
This commit is contained in:
Mark Olesen
2017-05-01 22:39:36 +02:00
parent 7cceda620d
commit 0298c02b2d
3 changed files with 40 additions and 6 deletions

View File

@ -21,6 +21,17 @@ int main()
SimpleClass* ptrToClass = new SimpleClass;
SimpleClass& refToClass(*ptrToClass);
typedef unsigned long ptrval;
Info<<"nullObject address=" << ptrval(&(nullObjectPtr)) << endl;
Info<<"sizeof(nullObject)" << " == "
<< sizeof(NullObject::nullObject)
<< " vs. sizeof(void*)" << " == " << sizeof(void*)
<< endl;
Info<<"nullObject pointer:" << ptrval(nullObjectPtr->pointer()) << endl;
Info<<"nullObject value:" << nullObjectPtr->value() << endl;
if (notNull(ptrToClass))
{
Info<< "Pass: ptrToClass is not null" << endl;