Re: add non-option reordering to in-tree getopt_long

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема Re: add non-option reordering to in-tree getopt_long
Дата
Msg-id 20230710181237.GD257945@nathanxps13
обсуждение исходный текст
Ответ на Re: add non-option reordering to in-tree getopt_long  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
Ответы Re: add non-option reordering to in-tree getopt_long  (Nathan Bossart <nathandbossart@gmail.com>)
Список pgsql-hackers
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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Nathan Bossart
Дата:
Сообщение: Re: Should we remove db_user_namespace?
Следующее
От: Melanie Plageman
Дата:
Сообщение: stats test intermittent failure