Ok i am sorry, i just did the math for real this time. You are right. I should have rushed to answer without checking my facts
A script object handle has mask of asTYPEID_MASK_OBJECT | asTYPEID_OBJHANDLE
An c++ object handle has mask of asTYPEID_APPOBJECT | asTYPEID_OBJHANDLE
I don't think there is anything wrong with if( subTypeId & asTYPEID_MASK_OBJECT ).
It doesn't care about handles because all handles are asTYPEID_APPOBJECT or asTYPEID_MASK_OBJECT or asTYPEID_TEMPLATE .
There aren't any handle types that doesn't fit those 3. No such thing as pure asTYPEID_OBJHANDLE