2 ms·
In 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 t
by nitrogen 13y ago
In 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=...