From: Junio C Hamano Date: Wed, 16 Apr 2025 18:50:42 GMT Subject: Re: [PATCH v3 5/7] parse-options: introduce `OPTION_UNSIGNED` Message-ID: In-Reply-To: <20250416-b4-pks-parse-options-integers-v3-5-d390746bea79@pks.im> Patrick Steinhardt writes: > We have two generic ways to parse integers in the "parse-options" > subsystem: > > - `OPTION_INTEGER` parses a signed integer. > > - `OPTION_MAGNITUDE` parses an unsigned integer, but it also > interprets suffixes like "k" or "g". > > Notably missing is a middle ground that parses unsigned integers without > interpreting suffixes. Introduce a new `OPTION_UNSIGNED` option type to > plug this gap. This option type will be used in subsequent commits. This takes a turn in a bit unexpected direction. Because the way to spell a scaled quantity is unambiguous in the sense that anything that used to be parsed with OPT_INTEGER() couldn't have had anything but "^-?[0-9]+$", an obvious alternative is to teach OPTION_INTEGER to always allow the scaling suffix if the user wants to use one, without adding a new "only numbers but this one does not even allow a sign" variant. Seriously, are there good candidates for an option where we want to absolutely refuse to take scaling suffix and insist only on a bare number?