| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера