Munich-Quantum-Software-Stack / QDMI

Quantum Device Management Interface (QDMI)
https://munich-quantum-software-stack.github.io/QDMI/
Apache License 2.0
26 stars 0 forks source link

🎨 Use `size_t` for sizes of buffers and number of returned values #81

Closed burgholzer closed 4 weeks ago

burgholzer commented 1 month ago

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.