3 ms·
There's another common C API pattern that I was surprised to not see mentioned. You pass a buffer pointer and the size of the buffer, and the function returns t
by mark-r 7y ago
There's another common C API pattern that I was surprised to not see mentioned. You pass a buffer pointer and the size of the buffer, and the function returns the number of items written to the buffer. If the pointer is null or the size is zero, the return value is the size that you need to allocate to ensure proper function completion.