Re: Out-of-memory error reports in libpq

Поиск
Список
Период
Сортировка
От Peter Smith
Тема Re: Out-of-memory error reports in libpq
Дата
Msg-id CAHut+Pthu7wpO4q9Heuxq8dvMH1vhSmUFEyDCPzyJBEG8PyEgQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Out-of-memory error reports in libpq  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Out-of-memory error reports in libpq  (Andrew Dunstan <andrew@dunslane.net>)
Re: Out-of-memory error reports in libpq  (Ranier Vilela <ranier.vf@gmail.com>)
Список pgsql-hackers
(This is not a code review - this is just to satisfy my curiosity)

I've seen lots of code like this where I may have been tempted to use
a ternary operator for readability, so I was wondering is there a PG
convention to avoid such ternary operator assignments, or is it simply
a personal taste thing, or is there some other reason?

For example:

if (msg)
  res->errMsg = msg;
else
  res->errMsg = libpq_gettext("out of memory\n");

VERSUS:

res->errMsg = msg ? msg : libpq_gettext("out of memory\n");

------
Kind Regards,
Peter Smith.
Fujitsu Australia



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

Предыдущее
От: Masahiko Sawada
Дата:
Сообщение: Re: Skipping logical replication transactions on subscriber side
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Some code cleanup for pgbench and pg_verifybackup