Re:C's designated initializers give us named arguments
by flohofwoe on Thursday November 19, 2026 @09:38AM
(#50560704)
Tbh I would skip all the preprocessor magic proposed in the article and just go for plain C99 'option bag struct' arguments. I've been using this style for almost 10 years now in the sokol headers, and it still feels like the right thing to do, e.g. see here for creating a 3D render pipeline object:
...this code snippet makes use of C99 features that are not available in C++20 though, and it's really remarkable how well designed the C99 designated init feature as a whole is and how badly its individual subfeatures were understood by most later languages.
...this code snippet makes use of C99 features that are not available in C++20 though, and it's really remarkable how well designed the C99 designated init feature as a whole is and how badly its individual subfeatures were understood by most later languages.