Re: C99 compliance for src/port/snprintf.c

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: C99 compliance for src/port/snprintf.c
Date: 2018-08-15 15:52:37
Message-ID: 20180815155237.pz5fgfmdo4cgqjta@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-www

Hi,

On 2018-08-15 11:41:46 -0400, Tom Lane wrote:
> BTW, independently of whether to back-patch, it strikes me that what
> we ought to do in HEAD (after applying this) is to just assume we have
> C99-compliant behavior, and rip out the baroque logic in psnprintf
> and appendPQExpBufferVA that tries to deal with pre-C99 snprintf.
> I don't expect that'd save any really meaningful number of cycles,
> but at least it'd buy back the two added instructions mentioned above.
> I suppose we could put in a configure check that verifies whether
> the system snprintf returns the right value for overrun cases, though
> it's hard to believe there are any platforms that pass the 'z' check
> and would fail this one.

We could just mandate C99, more generally.

/me goes and hides in a bush.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-08-15 15:53:27 Re: libpq should append auth failures, not overwrite
Previous Message Tom Lane 2018-08-15 15:41:46 Re: C99 compliance for src/port/snprintf.c

Browse pgsql-www by date

  From Date Subject
Next Message Alvaro Herrera 2018-08-15 15:56:43 Re: C99 compliance for src/port/snprintf.c
Previous Message Tom Lane 2018-08-15 15:41:46 Re: C99 compliance for src/port/snprintf.c