Open frank-aurich opened 3 years ago
Hi,
first of all, thank you very much for your contributions and for all valuable feedback!
Regarding this proposal, we could introduce this new constructor but not as a replacement of initialize
method. We see that this new constructor could be handy for top level structures.
For objects that need to be initialized, the initialization values should be part of the constructor.
Currently, you can create such objects just fine, but when trying to write them using
BitStreamWriter
, an exception will be thrown.Consider an object:
The generated C++ code will allow to write this code that compiles just fine, but throws an exception at runtime:
Instead we have to explicitly initialize the object:
Proposal
The
shift
value should be part of the constructor: