Conversation
backend/hdf5/h5x/H5DataType.cpp
Outdated
| } | ||
|
|
||
| void check_bool_enum(h5x::DataType type) { | ||
| assert(type.member_count() == 2); |
There was a problem hiding this comment.
assert statements can be turned into NOOPs with the right define (NDEBUG), which is not a good idea. Throwing an exception, or returning DataType::Nothing.
There was a problem hiding this comment.
On a second though, you should be able to use boolfiletype.enum_equal(type) for the check.
There was a problem hiding this comment.
I used assert since it's also used in data_type_from_h5 when the the vclass is unknown. It's also used when the member count in the compound data type is wrong.
Should those cases be throwing exceptions as well?
There was a problem hiding this comment.
Assert is to find programming errors. In general, if we didn't fuck up, then there should never be a case where any of the asserts are it. If for whatever reason that happens then in data_type_from_h5 we return a DataType::Nothing, which is one of the sensible things to do. Throwing an exception would also work, but I guess the user should never actually see it.
In the bool case if the asserts are "not working" then we would accept something not a bool as a bool which we really shouldn't do.
Appears to be writing the same way as h5py.
Temporary fix
479bde5 to
69d6216
Compare
Booleans are now stored as enums with members "FALSE" and "TRUE".
Fixes issue #635.