Re: pgsql: Trivial dead code removal: in makeObjectName(),

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: pgsql: Trivial dead code removal: in makeObjectName(),
Дата
Msg-id 42B7803D.5080606@samurai.com
обсуждение исходный текст
Ответ на Re: pgsql: Trivial dead code removal: in makeObjectName(), name1 must be  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-committers
Tom Lane wrote:
> I don't like either this change or the tab-complete one: this seems to
> me to reduce readability, as well as robustness in the face of future
> changes, in order to save nothing at all worth mentioning.

Can you elaborate on why you feel this reduces readability? I think it
is a slight readability improvement: keeping the redundant "if" check
suggests that the code is prepared to handle a NULL `name1', whereas
that is not the case. By removing the "if", it makes the code's
assumption (that name1 is non-NULL) more clear. A similar line of
reasoning applies to the tab-complete change.

As for "robustness in the face of future change", I don't see how it
makes any difference. The code presently assumes that `name1' is
non-NULL. If that changes, references to `name1' will need to be
checked, but that is neither difficult nor unexpected if you change the
range of values that can be assigned to `name1'. Or would you have us
add redundant "if (var)" checks before using any pointer variable, on
the principle that at some point in the future the code might change so
that the variable could be NULL?

-Neil

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: pgsql: Trivial dead code removal: in makeObjectName(), name1 must be
Следующее
От: tgl@svr1.postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql: Cause initdb to create a third standard database "postgres",