Skip site navigation (1) Skip section navigation (2)

Re: snprintf()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Kate F <kate(at)cats(dot)meow(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: snprintf()
Date: 2007-02-03 03:52:28
Message-ID: 27082.1170474748@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Kate F <kate(at)cats(dot)meow(dot)at> writes:
> ... does PostgreSQL replace my system's snprintf() prototype with
> its own implementation's?

We do on some platforms where configure decides the system version
is deficient ... I don't recall the exact conditions at the moment.
I wouldn't really have expected that to happen on any *BSD, but you
could look into the generated Makefile.global to find out.

> For reference, the relevant part of C99:
>   7.19.6.5 2 If n is zero, nothing is written, and s may be a null
>   pointer.

For reference, the relevant part of the Single Unix Spec:

	If the value of n is zero on a call to snprintf(), an
	unspecified value less than 1 is returned.

So the behavior you'd like to depend on is unportable anyway, and
that coding will get rejected if submitted as a Postgres patch.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Kate FDate: 2007-02-03 04:11:25
Subject: Re: snprintf()
Previous:From: Kate FDate: 2007-02-03 03:40:18
Subject: snprintf()

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group