Consider initializing compounds as default locals, properties, and global properties. There are two different mechanisms that would need to be changed.
Adding the initializations to the default constructor of the C++ struct should take care of local and global property declarations.
Because objects start out as a zeroed chunk of memory that is cast to a C++ struct on property access, here we need to modify each class's init_object() method to explicitly set each property compound to a new default struct.
An alternate approach would be to use C++ features to handle this (instead of init_object()), though it's probably more work (possibly a lot more) and not necessarily a clear win.
If a compound
XYZ
has this property definition:Then
z
will be initialized to 1 in these lines:but not in these lines:
Consider initializing compounds as default locals, properties, and global properties. There are two different mechanisms that would need to be changed.
Adding the initializations to the default constructor of the C++ struct should take care of local and global property declarations.
Because objects start out as a zeroed chunk of memory that is cast to a C++ struct on property access, here we need to modify each class's init_object() method to explicitly set each property compound to a new default struct.