mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user