I am looking for information on the real-world use of the H5S_NULL
dataspace flavor. My question was sparked by this discussion on the
h5py mailing list:
We are trying to figure out what to do at a high level in Python when
reading a string attribute created with H5S_NULL. Right now the two
main choices are to return an empty string, or to fail with an error.
Both have their merits but I thought I'd ask how other programs handle
this, e.g. Java, C++, etc. In the HDF5 C interface, it's legal to
perform a read from NULL -> SCALAR, but obviously nothing actually
happens (the output buffer is untouched).
I am particularly interested if H5S_NULL is being commonly used "in
the wild" as shorthand for an empty string.
Andrew, what an interesting question! I can't answer the question, but would
like to add an observation that might help finding an answer.
HDF5 attributes and datasets represent different uses of what some would
refer
to as array variables. What is the value of such an array variable?
An (HDF5) array variable is characterized by its datatype (T) and dataspace
(S).
It's value is a function v: S -> T, or it's graph G(v) := [(s,t) in SxT |
v(s) = t] .
For H5S_NULL, S is the empty set. The graph (the value of the array
variable) is also
the empty set.
How a particular API deals with that is another matter. In my opinion, it
shouldn't
be an error to read the empty set.
I am looking for information on the real-world use of the H5S_NULL dataspace
flavor. My question was sparked by this discussion on the h5py mailing
list:
We are trying to figure out what to do at a high level in Python when
reading a string attribute created with H5S_NULL. Right now the two main
choices are to return an empty string, or to fail with an error.
Both have their merits but I thought I'd ask how other programs handle this,
e.g. Java, C++, etc. In the HDF5 C interface, it's legal to perform a read
from NULL -> SCALAR, but obviously nothing actually happens (the output
buffer is untouched).
I am particularly interested if H5S_NULL is being commonly used "in the
wild" as shorthand for an empty string.