Re: [PATCH 1/2] parse-options: add int value pointer to struct option
- From
René Scharfe <l.s.r@web.de>
- Date
- Sep 20, 2023, 11:34 UTC
- Message-ID
- <daf41377-95ef-43ff-b4ce-a544a469a246@web.de>
- In-Reply-To
- <xmqq5y47mp58.fsf@gitster.g>
Am 18.09.23 um 18:17 schrieb Junio C Hamano:
Show 12 quoted lines
> René Scharfe <l.s.r@web.de> writes: > >> 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. > > It makes it impossible to use the both at the same time, which is a > bigger (than reduced memory) advantage. Otherwise, we would be > tempted to consider that having "void *value" and "int value_int" > next to each other and allow them to coexist may be a good solution > for a narrow corner case (please see at the end of the message you > are responding to).
Good point. The patch adds a check to parse_options_check() to prevent double use, which adds some runtime overhead and doesn't fully remove the temptation.
René