Re: pgsql: Clarify coding of .exe patch - Mailing list pgsql-committers

From Bruce Momjian
Subject Re: pgsql: Clarify coding of .exe patch
Date
Msg-id 200411011312.iA1DC5N29702@candle.pha.pa.us
Whole thread Raw
In response to Re: pgsql: Clarify coding of .exe patch  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: neilc@svr1.postgresql.org (Neil Conway)
Date:
Subject: pgsql: Trivial fixes for English grammar in contrib/btree_gist and
Next
From: momjian@svr1.postgresql.org (Bruce Momjian)
Date:
Subject: pgsql: Update comment to point to proper file.