Re: ANSI-strict pointer aliasing rules

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: ANSI-strict pointer aliasing rules
Дата
Msg-id 87hd4e7rd2.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: ANSI-strict pointer aliasing rules  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: ANSI-strict pointer aliasing rules  (Taral <taralx@gmail.com>)
Re: ANSI-strict pointer aliasing rules  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:

> Greg Stark <gsstark@mit.edu> writes:
>
> > 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.  

Are you saying it's important to preserve the ability for modules to add new
node types without notifying the rest of the code? I thought all the node
types were defined in a single header file currently anyways.

> 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).

You could use a local pointer to be preserve the existing model of a single
point where the decision is made. That could be encapsulated in a macro that
included an assertion to verify the type tag.

It would be pretty cool to have a type-safe codebase. It just seems like too
an awful lot of work for a mostly aesthetic improvement.

-- 
greg



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

Предыдущее
От: "Larry Rosenman"
Дата:
Сообщение: Re: Logging pg_autovacuum
Следующее
От: Taral
Дата:
Сообщение: Re: ANSI-strict pointer aliasing rules