Re: pg_tablespace_databases - Mailing list pgsql-patches

From Tom Lane
Subject Re: pg_tablespace_databases
Date
Msg-id 28599.1089119964@sss.pgh.pa.us
Whole thread Raw
In response to Re: pg_tablespace_databases  (Bruce Momjian <pgman@candle.pha.pa.us>)
Responses Re: pg_tablespace_databases
List pgsql-patches
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Tom Lane wrote:
>> [ shrug... ]  The name is not going to change again.  I have never cared
>> for the practice of writing strlen("foo") as if it were a compile-time
>> constant.

> I think with gcc strlen("foo") is a compile-time constant.

Portability is exactly the root of the problem.  If you are in the habit
of doing this then you get led into unportable behaviors like
    char    localarray[strlen(foo) + 1];
which no compiler except gcc will take.  (We just had to fix exactly
that mistake in someone's patch within the last week or two.)

> What do you prefer?

I use "3" ;-).  As long as the size calculation and the filling of the
string are immediately adjacent, the purpose of the code is clear
enough.

            regards, tom lane

pgsql-patches by date:

Previous
From: Gavin Sherry
Date:
Subject: Re: pg_tablespace_databases
Next
From: Bruce Momjian
Date:
Subject: Re: [PATCH] s_lock support for win32