Re: Remove redundant assignment of a variable in function AlterPublicationTables

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Remove redundant assignment of a variable in function AlterPublicationTables
Дата
Msg-id aKZkJaqzKStuoQK0@paquier.xyz
обсуждение исходный текст
Ответ на Re: Remove redundant assignment of a variable in function AlterPublicationTables  (Chao Li <li.evan.chao@gmail.com>)
Ответы Re: Remove redundant assignment of a variable in function AlterPublicationTables
Re: Remove redundant assignment of a variable in function AlterPublicationTables
Список pgsql-hackers
On Wed, Aug 20, 2025 at 05:18:53PM +0800, Chao Li wrote:
> If we look into the subsequent functions, yes, “isnull” will always
> be assigned. But how about if someone incidentally changed a
> subsequent function and moved an assignment?
> I think giving an initial value is a good habit without much
> performance burden.

It does not matter to leave the code as is.  We have a bunch of these
depending on how people feel on the day when they implement something.

Compilers are smart enough to optimize such things away when they don't
matter, usually.  Some compiler versions and flags can also be very
picky with initializations not done, missing that sometimes a variable
is actually set in all the relevant code paths.  Warnings can show
depending on the complexity of the branches used, as well.
--
Michael

Вложения

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