2 ms·
I'm guessing this is common API design in the world of C libraries? Coming from Swift / other high-level languages, it seems awfully error-prone to have to call
by blkhp19 5y ago
I'm guessing this is common API design in the world of C libraries? Coming from Swift / other high-level languages, it seems awfully error-prone to have to call an API multiple times, sometimes with null arguments, sometimes with pointers to buffers that hopefully are the right size, just to process some data. Programmer errors / misinterpretation of the documentation leading to programmer errors seems inevitable.
- da_big_ghey 5y agoYes this is common design in cases where a library is used from memory-managed language but does not want to do own allocation. Very useful in case like embedded where some screwy behavior are needed for allocating correct.