Re: Out-of-memory error reports in libpq

Поиск
Список
Период
Сортировка
Искать
От
Tom Lane
Тема
Re: Out-of-memory error reports in libpq
Дата
Msg-id
711012.1627567032@sss.pgh.pa.us
Ответ на
Список
Дерево обсуждения
Out-of-memory error reports in libpq Tom Lane <tgl@sss.pgh.pa.us>
Re: Out-of-memory error reports in libpq "Bossart, Nathan" <bossartn@amazon.com>
Re: Out-of-memory error reports in libpq Tom Lane <tgl@sss.pgh.pa.us>
Re: Out-of-memory error reports in libpq Michael Paquier <michael@paquier.xyz>
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 Tom Lane <tgl@sss.pgh.pa.us>
Re: Out-of-memory error reports in libpq Andres Freund <andres@anarazel.de>
Re: Out-of-memory error reports in libpq Tom Lane <tgl@sss.pgh.pa.us>
Re: Out-of-memory error reports in libpq Tom Lane <tgl@sss.pgh.pa.us>
Re: Out-of-memory error reports in libpq Tom Lane <tgl@sss.pgh.pa.us>
Re: Out-of-memory error reports in libpq Ranier Vilela <ranier.vf@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 Ranier Vilela <ranier.vf@gmail.com>
Re: Out-of-memory error reports in libpq Peter Smith <smithpb2250@gmail.com>
Re: Out-of-memory error reports in libpq Ranier Vilela <ranier.vf@gmail.com>
Re: Out-of-memory error reports in libpq Andrew Dunstan <andrew@dunslane.net>
Re: Out-of-memory error reports in libpq Tom Lane <tgl@sss.pgh.pa.us>
Re: Out-of-memory error reports in libpq Robert Haas <robertmhaas@gmail.com>
Re: Out-of-memory error reports in libpq Andrew Dunstan <andrew@dunslane.net>
Andrew Dunstan  writes:
> On 7/29/21 3:01 AM, Peter Smith wrote:
>> 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?

> A simple grep on the sources should disabuse you of any idea that there
> is such a convention. The code is littered with examples of the ?: operator.

Yeah.  I happened not to write it that way here, but if I'd been reviewing
someone else's code and they'd done it that way, I'd not have objected.

In the case at hand, I'd personally avoid a ternary op for the first
assignment because then the line would run over 80 characters, and
you'd have to make decisions about where to break it.  (We don't have
a standardized convention about that, and none of the alternatives
look very good to my eye.)  Then it seemed to make sense to also
write the second step as an "if" not a ternary op.

			regards, tom lane


В списке pgsql-hackers по дате отправления
От: Geoff Winkless
Дата:
От: Dmitry Dolgov
Дата:
FAQ