Re: [PATCH 1/2] parse-options: add int value pointer to struct option
- From
Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
- Date
- Sep 18, 2023, 10:28 UTC
- Message-ID
- <ZQgmQJvN0phJsFjz@ugly>
- In-Reply-To
- <2349e897-9e0d-4341-86fc-9da117a1eb48@web.de>
On Mon, Sep 18, 2023 at 11:53:19AM +0200, René Scharfe wrote:
Show 12 quoted lines
>Am 11.09.23 um 21:19 schrieb Junio C Hamano:
>> 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 is somewhat ironic, given that using a union has some semantic value by illustrating that the fields are mutually exclusive. but i'm not sure that the checking is really important here, given that the initializers are inside centralized macros anyway.
regards