| ▲ | DarkUranium 21 hours ago | |
I use this all the time in C (specifically, C99 or later). I first saw it used in anger in `sokol_gfx`, and loved it. `FLECS` does something similar. C makes it much better than C++ in that the designated initializes can be set in any order --- so I don't need to remember the often-arbitrary order of struct fields for the options struct. I find it weird that C++ took this great C feature and kneecapped it ... | ||
| ▲ | DarkUranium 21 hours ago | parent [-] | |
Addendum: I've been wanting to make my own shading language (for a number of reasons), and this feature is one I'd definitely include. Think (for example) using a pluggable PBR module in this way, where you give it a config/options struct instead of a weird combination of `#if`, runtime arguments, and predefined uniforms and/or function names. | ||