Hacker News new | ask | show | jobs
by nitrogen 4629 days 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.
1 comments

The book 21st century C talks about that trick:

http://books.google.fr/books?id=_EdbrocXX9MC&lpg=PA183&ots=D...