4 ms·
I find the descriptive nature of method signatures to be quite delightful. Unlike other languages like C++, I don't always have to go looking for the function d
by shaggyfrog 13y ago
I find the descriptive nature of method signatures to be quite delightful. Unlike other languages like C++, I don't always have to go looking for the function definition to see the types of the parameters it takes, and what exactly was the order again? Combined with Xcode's autocomplete, it saves a lot of time.
I shed a small tear every time I have to call a C API with and endless parade of (NULL, NULL, 0, NULL).
- nitrogen 13y agoIn C99 it's possible to use compound literals to implement something like named parameters. You create a struct with all of your parameters, and only include the ones you want to set in the compound literal. Anything not explicitly specified in the compound literal gets set to 0, so the caveat is that 0 can't be a valid value for your parameters.
- epsylon 13y agoThe book 21st century C talks about that trick: http://books.google.fr/books?id=_EdbrocXX9MC&lpg=PA183&ots=D8EhqfWRSU&pg=PA183#v=onepage&q&f=false http://books.google.fr/books?id=_EdbrocXX9MC&lpg=PA183&ots=D...
- j_s 13y agoSwitch .fr to .com: http://books.google.com/books?id=_EdbrocXX9MC&lpg=PA183&ots=D8EhqfWRSU&pg=PA183#v=onepage&q&f=false http://books.google.com/books?id=_EdbrocXX9MC&lpg=PA183&ots=...
- jasonlotito 13y ago> I don't always have to go looking for the function definition That's because you get it inline for you with Xcode's autocomplete. IDEs do this for other languages, and the effect is the same.