Re: libpq object hooks

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: libpq object hooks
Дата
Msg-id 17534.1210951450@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: libpq object hooks  ("Merlin Moncure" <mmoncure@gmail.com>)
Список pgsql-patches
"Merlin Moncure" <mmoncure@gmail.com> writes:
> Switch, plus struct (basically a union) will do the trick nicely.  Can
> it be a formal union, or is it better as a void*?

I don't think a union buys much notational convenience or safety here,
although admittedly it's a close question.  In one case you're trusting
to cast the pointer to the appropriate type, in the other you're
trusting to use the right union member.  One advantage of separate
structs is that there's no reason not to make the struct type names
long enough to be clear, whereas there's a very strong notational
temptation to make union member names short, because you'll be typing
them a lot.

            regards, tom lane

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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: libpq object hooks
Следующее
От: Tom Lane
Дата:
Сообщение: Re: libpq object hooks