This is the mail archive of the ecos-bugs@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug 1000800] Diagnostics API does not include diag_vsnprintf


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]