Re: pgsql: Clarify coding of .exe patch

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: pgsql: Clarify coding of .exe patch
Дата
Msg-id 200411011312.iA1DC5N29702@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: pgsql: Clarify coding of .exe patch  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-committers
Tom Lane wrote:
> Neil Conway <neilc@samurai.com> writes:
> > While I still think we're on pretty solid ground assuming this
> > optimization is going to be made, I'm fine with defining something like
> > const_strlen() that uses sizeof(). Also, we can guard against programmer
> > mistakes via __builtin_constant_p() when using GCC.
>
> I think both you and Bruce are missing the really fundamental point
> here.  You are both optimizing on the grounds that there is no god but
> RMS and his prophet is GCC.  I have a somewhat wider view of which
> compilers we want to target.

Just to clarify, I am not against the use of sizeof() and I understand
Tom's point.  My issue was the use of a constant that doesn't clearly
document.

As I remember the ability of the compiler to evaluate strlen is that if
there is a prototype in scope for strlen() that is somehow different
from the compilers then the compiler can not make the optimization.  I
see my BSD using:

    size_t   strlen __P((const char *));

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

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

Предыдущее
От: neilc@svr1.postgresql.org (Neil Conway)
Дата:
Сообщение: pgsql: Trivial fixes for English grammar in contrib/btree_gist and
Следующее
От: momjian@svr1.postgresql.org (Bruce Momjian)
Дата:
Сообщение: pgsql: Update comment to point to proper file.