Am 11.09.23 um 21:19 schrieb Junio C Hamano: > Taylor Blau <me@xxxxxxxxxxxx> writes: > >> callback, something like: >> >> struct option { >> /* ... */ >> union { >> void *value; >> int *value_int; >> /* etc ... */ >> } u; >> enum option_type t; >> }; >> >> where option_type has some value corresponding to "void *", another for >> "int *", and so on. > > Yup, that does cross my mind, even though I would have used > > union { > void *void_ptr; > int *int_ptr; > } value; > > or something without a rather meaningless 'u'. OK, but I neglected to ask what we would get out of throwing different types into the same bin. It complicates type safety by making it impossible for the parser to distinguish the used type. This will become relevant once all int options are converted and value_int can be made mandatory for them. A named union also requires changing all users. It reduces the memory footprint, but only slightly. Saving a few bytes for objects with less than a hundred instances total doesn't seem worth the downsides. René