Re: [HACKERS] cast result of copyNode()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] cast result of copyNode()
Дата
Msg-id 32425.1483203361@sss.pgh.pa.us
обсуждение исходный текст
Ответ на [HACKERS] cast result of copyNode()  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Ответы Re: [HACKERS] cast result of copyNode()  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
Список pgsql-hackers
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> In order to reduce the number of useless casts and make the useful casts
> more interesting, here is a patch that automatically casts the result of
> copyNode() back to the input type, if the compiler supports something
> like typeof(), which most current compilers appear to.  That gets us
> some more type safety and we only need to retain the casts that actually
> do change the type.

But doesn't this result in a boatload of warnings on compilers that
don't have typeof()?

If typeof() were in C99 I might figure that is an okay tradeoff,
but it isn't.  I'm not sure that this is the most useful place
to be moving our C standards compliance expectations by 20 years
in one jump.

Also, if your answer is "you shouldn't get any warnings because
copyObject is already declared to return void *", then why aren't
we just relying on that today?
        regards, tom lane



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

Предыдущее
От: Fabien COELHO
Дата:
Сообщение: Re: [HACKERS] proposal: session server side variables
Следующее
От: Peter Eisentraut
Дата:
Сообщение: [HACKERS] safer node casting