Re: [PATCH] Redudant initilization

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCH] Redudant initilization
Дата
Msg-id 1220069.1599326948@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [PATCH] Redudant initilization  (Ranier Vilela <ranier.vf@gmail.com>)
Ответы Re: [PATCH] Redudant initilization
Список pgsql-hackers
Ranier Vilela <ranier.vf@gmail.com> writes:
> Attached is a patch I made in March/2020, but due to problems,
> it was sent but did not make the list.
> Would you mind taking a look?

I applied some of this, but other parts had been overtaken by
events, and there were other changes that I didn't agree with.

A general comment on the sort of "dead store" that I don't think
we should remove is where a function is trying to maintain an
internal invariant, such as "this pointer points past the last
data written to a buffer" or "these two variables are in sync".
If the update happens to be the last one in the function, the
compiler may be able to see that the store is dead ... but IMO
it should just optimize such a store away and not get in the
programmer's face about it.  If we manually remove the dead
store then what we've done is broken the invariant, and we'll
pay for that in future bugs and maintenance costs.  Somebody
may someday want to add more code after the step in question,
and if they fail to undo the manual optimization then they've
got a bug.  Besides which, it's confusing when a function
does something the same way N-1 times and then differently the
N'th time.

            regards, tom lane



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

Предыдущее
От: Juan José Santamaría Flecha
Дата:
Сообщение: Re: A micro-optimisation for walkdir()
Следующее
От: Ranier Vilela
Дата:
Сообщение: Re: [PATCH] Redudant initilization