3 ms·
getenv() is just a sample. But even with it... it puts some limitation on potential API implementation and overall system performance. E.g. const char* user_pas
by c-smile 4y ago
getenv() is just a sample. But even with it... it puts some limitation on potential API implementation and overall system performance. E.g. const char* user_password() cannot store the data anywhere, right? All that...
> The most comfortable way to do a C API is to make the caller allocate space for return values
That's even worse. How will caller know size of the buffer upfront?
With the callback approach that is trivial - you get the size on call - no need to call the API function twice - for size of the buffer and then for real copy.