Neil Conway <[EMAIL PROTECTED]> writes:
> Regarding __builtin_constant_p(), it is obviously the case that we need
> to ensure the code compiles on a wide variety of C compilers. But I
> don't see the harm in using GCC-specific features where (a) they can be
> easily #ifdef'd away when not using GCC
Tom Lane wrote:
> Neil Conway <[EMAIL PROTECTED]> 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 __bu
On Mon, 2004-11-01 at 17:29, Tom Lane wrote:
> 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.
:-)
Regar
Neil Conway <[EMAIL PROTECTED]> 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 us
On Mon, 2004-11-01 at 16:47, Tom Lane wrote:
> sizeof() is defined as a compile-time constant by the C language
> specification. strlen() is not a compile-time constant, and in my
> judgement a compiler that evaluates it as such is exceeding its
> authority.
Well, I suppose it's a little weird,
Neil Conway <[EMAIL PROTECTED]> writes:
> Tom, can you elaborate on why you prefer sizeof()? ISTM that a decent
> compiler will evaluate the strlen() at compile-time if the argument is a
> compile-time constant. GCC will do this (even at -O0!), for example.
sizeof() is defined as a compile-time co
On Mon, 2004-11-01 at 16:04, Bruce Momjian wrote:
> I prefer strlen() myself but Tom prefers sizeof(). In the long run I
> would like to create a 'sizeof' that doesn't include the null as a
> global define that we can use for any hard-coded string.
Tom, can you elaborate on why you prefer sizeof(
Bruce Momjian <[EMAIL PROTECTED]> writes:
> ! if (strlen(nodir_name) > sizeof(EXE) - 1 &&
> ! pg_strcasecmp(nodir_name + strlen(nodir_name)-sizeof(EXE)-1, EXE) == 0)
This is clearer than "4"?
If there were any remote chance that Microsoft would invent some new,
different-length sp
Neil Conway wrote:
> On Mon, 2004-11-01 at 15:47, Bruce Momjian wrote:
> > Oh, I didn't realize they had the dot in there. Let me add "-1".
> > Thanks. Attached.
>
> I wonder if it wouldn't be cleaner to #define SIZE_OF_EXE or similar
> that includes the "-1". Alternatively, we could just use s
Tom Lane wrote:
> Bruce Momjian <[EMAIL PROTECTED]> writes:
> > ! if (strlen(nodir_name) > sizeof(EXE) - 1 &&
> > ! pg_strcasecmp(nodir_name + strlen(nodir_name)-sizeof(EXE)-1, EXE) == 0)
>
> This is clearer than "4"?
>
> If there were any remote chance that Microsoft would invent som
On Mon, 2004-11-01 at 15:47, Bruce Momjian wrote:
> Oh, I didn't realize they had the dot in there. Let me add "-1".
> Thanks. Attached.
I wonder if it wouldn't be cleaner to #define SIZE_OF_EXE or similar
that includes the "-1". Alternatively, we could just use strlen(): I
believe a decent com
Neil Conway wrote:
> On Mon, 2004-11-01 at 15:25, Bruce Momjian wrote:
> > Clarify coding of .exe patch
>
> This change looks wrong: sizeof(".exe") is 5, not 4 (it includes the NUL
> terminator).
Oh, I didn't realize they had the dot in there. Let me add "-1".
Thanks. Attached.
--
Bruce Mo
On Mon, 2004-11-01 at 15:25, Bruce Momjian wrote:
> Clarify coding of .exe patch
This change looks wrong: sizeof(".exe") is 5, not 4 (it includes the NUL
terminator).
-Neil
---(end of broadcast)---
TIP 8: explain analyze is your friend
Log Message:
---
Clarify coding of .exe patch
Modified Files:
--
pgsql/src/port:
path.c (r1.38 -> r1.39)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/port/path.c.diff?r1=1.38&r2=1.39)
---(end of broadcast)--
14 matches
Mail list logo