Re: [PATCH 1/3] git-compat-util: introduce skip_to_opt_val()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Dec 3, 2017, 22:48 UTC
- Message-ID
- <xmqqfu8rig10.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <CAP8UFD2OSsqzhyAL-QG1TOowB-xgbf=kC9wHre+FLc+0J1Xy+Q@mail.gmail.com>
Christian Couder <christian.couder@gmail.com> writes:
> Anyway there is a design choice to be made. Adding a "const char > *default" argument makes the function more generic,...
I didn't suggest anything of that sort, and I do not understand why you are repeatedly talking about "default" that you considered and rejected, as if it were an alternative viable option. I agree that "default" is not yet a good idea and it is a solution to a problem that is not yet shown to exist.
On the other hand, just assigning NULL to *arg when you did not see a delimiting '=', on the other hand, is an alternative option that is viable.
> .... I think setting > "arg" to NULL increases the risk of crashes and makes it too easy to > make "--key" and "--key=" behave differently which I think is not > consistent and not intuitive.
So now this is very specific to the need of command line argument parsing and is not a generic thing? You cannot have your cake and eat it too, though.