[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
correct snprintf implementation
From: |
BORBELY Zoltan |
Subject: |
correct snprintf implementation |
Date: |
Thu, 4 Apr 2002 00:36:53 +0200 |
User-agent: |
Mutt/1.2.5.1i |
Hello,
On Wed, Apr 03, 2002 at 05:18:51PM +0200, Pawel Kot wrote:
> exit (!(buf[2] == 0) && !(snprintf(NULL, 0, "%d", 100)));
It isn't correct (non C99 compliant snprintf will return -1).
> PS. Is the buf declaration valid or is it gccism?
char buf[] = {0, 0, 0, 0};
is fully C compliant.
I managed to add a good GPL compatible snprintf implementation. It provides
snprintf/vsnprintf/asprintf/vasprintf implementation. The snprintf/vsnprintf
implementation is ISO C99 compliant. It will _always_ terminate the output
string, so everyone can rely on it.
Bye,
Bozo
- Re: Good bits from Marcin's patch3, (continued)
Re: Good bits from Marcin's patch3, BORBELY Zoltan, 2002/04/03
Re: Good bits from Marcin's patch3, Pawel Kot, 2002/04/03
Re: Good bits from Marcin's patch3, Pawel Kot, 2002/04/03
Re: Good bits from Marcin's patch3, Pawel Kot, 2002/04/03
Re: Good bits from Marcin's patch3, Glenn Satchell, 2002/04/03
Re: Good bits from Marcin's patch3, Pawel Kot, 2002/04/03
- correct snprintf implementation,
BORBELY Zoltan <=