From: Nathan Bossart <nathandbossart@gmail.com>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: michael@paquier.xyz
Cc: noah@leadboat.com
Cc: pgsql-hackers@postgresql.org
Subject: Re: add non-option reordering to in-tree getopt_long
Date: Mon, 10 Jul 2023 11:12:37 -0700
Message-ID: <20230710181237.GD257945@nathanxps13> (raw)
In-Reply-To: <20230710.165711.1906730109995973216.horikyota.ntt@gmail.com>
References: <20230620.141244.1061039848681375358.horikyota.ntt@gmail.com>
<20230621175624.GA882103@nathanxps13>
<20230708035224.GA4042213@nathanxps13>
<20230710.165711.1906730109995973216.horikyota.ntt@gmail.com>
On Mon, Jul 10, 2023 at 04:57:11PM +0900, Kyotaro Horiguchi wrote:
> + if (!force_nonopt && place[0] == '-' && place[1])
> + {
> + if (place[1] != '-' || place[2])
> + break;
> +
> + optind++;
> + force_nonopt = true;
> + continue;
> + }
>
> The first if looks good to me, but the second if is a bit hard to get the meaning at a glance. "!(place[1] == '-' && place[2] == 0)" is easier to read *to me*. Or I'm fine with the following structure here.
I'd readily admit that it's tough to read these lines. I briefly tried to
make use of strcmp() to improve readability, but I wasn't having much luck.
I'll give it another try.
>> if (!force_nonopt ... )
>> {
>> if (place[1] == '-' && place[2] == 0)
>> {
>> optind+;
>> force_nonopt = true;
>> continue;
>> }
>> break;
>> }
>
> (To be honest, I see the goto looked clear than for(;;)..)
Okay. I don't mind adding it back if it improves readability.
--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: nathandbossart@gmail.com, horikyota.ntt@gmail.com, michael@paquier.xyz, noah@leadboat.com
Subject: Re: add non-option reordering to in-tree getopt_long
In-Reply-To: <20230710181237.GD257945@nathanxps13>
References: <20230620.141244.1061039848681375358.horikyota.ntt@gmail.com> <20230621175624.GA882103@nathanxps13> <20230708035224.GA4042213@nathanxps13> <20230710.165711.1906730109995973216.horikyota.ntt@gmail.com> <20230710181237.GD257945@nathanxps13>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox