Re: pgsql: Clarify coding of .exe patch

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: pgsql: Clarify coding of .exe patch
Дата
Msg-id 4803.1099285305@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: pgsql: Clarify coding of .exe patch  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: pgsql: Clarify coding of .exe patch
Список pgsql-committers
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> !     if (strlen(nodir_name) > sizeof(EXE) - 1 &&
> !         pg_strcasecmp(nodir_name + strlen(nodir_name)-sizeof(EXE)-1, EXE) == 0)

This is clearer than "4"?

If there were any remote chance that Microsoft would invent some new,
different-length spelling of the ".exe" suffix in the foreseeable
future, I might agree that this was good code.  As is, it looks like
unhelpful obscurantism, because it requires a very close reading of the
details of the C spec to confirm that it is correct and not wrong.

Code that looks wrong on its face is not an improvement over code that
is readable but doesn't cover changes that won't ever happen.

            regards, tom lane

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: pgsql: Clarify coding of .exe patch
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: pgsql: Clarify coding of .exe patch