Re: ANSI-strict pointer aliasing rules

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ANSI-strict pointer aliasing rules
Дата
Msg-id 12187.1146156610@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: ANSI-strict pointer aliasing rules  (Greg Stark <gsstark@mit.edu>)
Ответы Re: ANSI-strict pointer aliasing rules  (Taral <taralx@gmail.com>)
Re: ANSI-strict pointer aliasing rules  (Greg Stark <gsstark@mit.edu>)
Список pgsql-hackers
Greg Stark <gsstark@mit.edu> writes:
> Martijn van Oosterhout <kleptog@svana.org> writes:
>> You're right, PostgreSQL uses a form of subclassing, so that a (for
>> example) struct ArrayRefExprState is occasionally referred to using a
>> (struct ExprState*) or even a (struct Node*). In C, the logical way to
>> get that to work it by casting, do you have a better way?

> There are other ways of achieving the same thing. Structs containing a union
> for the subclass fields for example.

Doesn't achieve the same thing, unless you mandate that every part of
the system use the identical massively-overloaded union struct to refer
to every node.  That would (a) defeat the purpose of extensibility, and
(b) make the code more error prone not less so (since it'd be
notationally easy to refer to a field that's not actually present in the
given node subtype).
        regards, tom lane


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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: GIN - Generalized Inverted iNdex. Try 3.
Следующее
От: Tom Lane
Дата:
Сообщение: Re: GIN - Generalized Inverted iNdex. Try 3.