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

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.



The book 21st century C talks about that trick:

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





Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: