Hacker News new | past | comments | ask | show | jobs | submit login

There you go:

  struct much_improved_c { ... };

  struct much_improved_c an_api_that_doesnt_suck() { ... };



I 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


This 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.


The 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.




Applications are open for YC Winter 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: