Quite a lot of the functions within QDMI pass around buffers that are subsequently filled with data. For all of these, a size argument is passed in addition to a pointer to the actual buffer.
Right now, the type used for these size arguments is int.
However, C/C++ actually has a proper size_t type, which is the unsigned integer type returned by the sizeof operator.
In order to avoid some of the casts throughout the QDMI implementations, the function signatures should be adapted to use size_t instead of int for specifying the size of the buffers as well as the number of returned elements from QDMI functions (which is guaranteed to be non-negative).
In addition, the example implementation should be updated to use size_t and remove all the unnecessary casts.
Quite a lot of the functions within QDMI pass around buffers that are subsequently filled with data. For all of these, a
size
argument is passed in addition to a pointer to the actual buffer. Right now, the type used for these size arguments isint
. However, C/C++ actually has a propersize_t
type, which is the unsigned integer type returned by thesizeof
operator. In order to avoid some of the casts throughout the QDMI implementations, the function signatures should be adapted to usesize_t
instead ofint
for specifying the size of the buffers as well as the number of returned elements from QDMI functions (which is guaranteed to be non-negative). In addition, the example implementation should be updated to usesize_t
and remove all the unnecessary casts.