Re: *printf and zero size

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: *printf and zero size
Date: 2005-12-05 21:05:58
Message-ID: 2524.1133816758@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> Tom, did you implement this functionality in *printf?
> The size may be given as zero to find out how many characters are
> needed; in this case, the str argument is ignored. Sprintf() and
> vsprintf() effectively assume an infinite size.

Where do you read that? The SUS says the opposite:

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

and that's what our code implements.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-12-05 21:35:31 Re: *printf and zero size
Previous Message Bruce Momjian 2005-12-05 20:44:51 *printf and zero size