4 ms·
I would add multiple return so api's don't suck.
by andrewchambers 11y ago
I would add multiple return so api's don't suck.
- huhtenberg 11y agoThere you go: struct much_improved_c { ... }; struct much_improved_c an_api_that_doesnt_suck() { ... };
- LoSboccacc 11y agoI always found that unnatural in C and preferred the other way around: to pass the struct to populate as a pointer and keep the return code for tracking operation status/handlers
- deleted 11y ago[deleted]
- veli_joza 11y agoThis is the only way it can be done in statically typed language. You cannot have multiple returns without defining how many there are what are their types.
- jjnoakes 11y agoThe definition of what they are and how many could just as easily be done at the function declaration. There is no requirement that multiple return types in a static language have to be declared separately and verbosely. That is just how C does it.