Stabilizing Changes
Addition of operator==
As part of the .NET work, the equals method (operator==) was added to many classes. These methods all implement deep comparisons to check if an instance is equal to another instance.
Static Compile Time Assert
Functionality was added in maxsdk\\include\\Util\\StaticAssert.h
to enable compile time asserts. If the assert fails it will emit a compiler error. Users can use this assert, or the new static assert that comes with the new VC10 compiler.
Minimizing use of Tab with non-POD types
Usage of the Tab class was minimized in the SDK and in the product. In many places it was found that Tab was used with data types that were not Plain Old Data (POD), despite warnings in the documentation that this is bad practice.
To enable the compile time asserts, the file maxsdk\\include\\PodTypeCheck.h
contains a define (ADSK_MAXSDK_NO_POD_TYPE_CHECK) that, when turned off (or not defined) emits a compiler error when Tab is used with a non-POD type. For instance, to activate this, comment out the define in PodTypeCheck.h. Attempting to use a Tab of BitArray's will emit an error:
// [PodTypeCheck.h]
// #define ADSK_MAXSDK_NO_POD_TYPE_CHECK
// ...
Tab<BitArray> foo; // emits a compiler error
Other changes in the SDK included changes to parameter types and changes to class inheritance. For instance GUPList now inherits from MaxSDK::Array
instead of Tab.
Hold::Put() returns a boolean
The method Hold::Put(RestoreObj *)
used to return void
, but now returns bool
. It returns true
if the RestoreObj
pointer was successfully kept in the hold storage, and false
otherwise. This is important, because it gives the user the ability to delete the RestoreObj
if the result is false
. Note that the Hold
class does not free the RestoreObj
's memory if the put operation fails.
// Avoid this:
lHold.Put(new MyRestoreAction()); // A memory leak occurs if this fails.
// Do this:
MyRestoreAction* undoable = new MyRestoreAction();
if (lHold.Put(undoable) == false)
delete undoable;