Re: inline newNode()

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: inline newNode()
Дата
Msg-id 87ptulq3ww.fsf@mailbox.samurai.com
обсуждение исходный текст
Ответ на Re: inline newNode()  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: inline newNode()  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: inline newNode()  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-patches
Tom Lane <tgl@sss.pgh.pa.us> writes:
> How much did you bloat the code?  There are an awful lot of calls to
> newNode(), so even though it's not all that large, I'd think the
> multiplier would be nasty.

The patch increases the executable from 12844452 to 13005244 bytes,
when compiled with '-pg -g -O2' and without being stripped.

> This isn't portable at all, AFAIK :-(.  Unfortunately I can't think
> of a portable way to do it with a macro, either.

Well, one alternative might be to provide 2 definitions of the
function -- one an extern inline in the header file, and one using the
current method (in a separate file, non-inline). Then wrap the header
file in an #ifdef __GNUC__ block, and the non-inlined version in
#ifndef __GNUC__. The downside is that it means maintaining two
versions of the same function -- but given that newNode() is pretty
trivial, that might be acceptable.

BTW, the GCC docs on inline functions are here:

        http://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Inline.html#Inline

According to that page, using 'static inline' instead of 'extern
inline' is recommended for future compatability with C99, so that's
what we should probably use (in the __GNUC__ version).

Cheers,

Neil

--
Neil Conway <neilc@samurai.com> || PGP Key ID: DB3C29FC

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

Предыдущее
От: Kris Jurka
Дата:
Сообщение: Re: [JDBC] DBMD Patch
Следующее
От: Tom Lane
Дата:
Сообщение: Re: inline newNode()