This is the mail archive of the
ecos-bugs@sourceware.org
mailing list for the eCos project.
[Bug 1000800] Diagnostics API does not include diag_vsnprintf
- From: bugzilla-daemon at bugs dot ecos dot sourceware dot org
- To: ecos-bugs at ecos dot sourceware dot org
- Date: Sun, 21 Nov 2010 05:29:24 +0000
- Subject: [Bug 1000800] Diagnostics API does not include diag_vsnprintf
- Auto-submitted: auto-generated
- References: <bug-1000800-13@http.bugs.ecos.sourceware.org/>
Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1000800
--- Comment #9 from Jonathan Larmour <jifl@ecoscentric.com> 2010-11-21 05:29:20 GMT ---
libc's snprintf is correct for ISO C99. Before C99, yes what you said would be
right that the way most people implemented snprintf would mean snprintf's
return value behaved similarly to sprintf's. But C99 changed things somewhat
and said the return value would be the number of characters that would have
been written if the 'n' argument was large enough. So you can detect a
truncated write if the returned value is >= n.
But diag_snprintf does not have to meet ISO C criteria - it's our own function
and it is more important that it be simple. That said, it would be probably be
wise to add a comment beside its prototype in diag.h noting this difference.
--
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.