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


From: Kate F <kate(at)cats(dot)meow(dot)at>
To: pgsql-hackers(at)postgresql(dot)org
Subject: snprintf()
Date: 2007-02-03 03:40:18
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

I've been implementing a type I needed, and happened to be using
snprintf(), since I have C99 available.

		errmsg("%d", snprintf(NULL, 0, "abc"))));

For me, this reports "0". I beieve it should report 3. My system's
snprintf() returns 3. I'm using NetBSD. By including postgres.h and
fmgr.h, does PostgreSQL replace my system's snprintf() prototype with
its own implementation's?

Placing stdio.h above those includes appears to have no effect.

For reference, the relevant part of C99: 2 If n is zero, nothing is written, and s may be a null
  pointer. 3 The snprintf function returns the number of characters
  that would have been written had n been sufficiently large, not
  counting the terminating null character, or a neg ative value if an
  encoding error occurred.




pgsql-hackers by date

Next:From: Tom LaneDate: 2007-02-03 03:52:28
Subject: Re: snprintf()
Previous:From: Jeremy DrakeDate: 2007-02-03 03:01:33
Subject: Re: [HACKERS] writing new regexp functions

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