From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8008 invoked by alias); 23 May 2009 17:13:24 -0000 Received: (qmail 7993 invoked by uid 22791); 23 May 2009 17:13:23 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout7.012.net.il (HELO mtaout7.012.net.il) (84.95.2.19) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 23 May 2009 17:13:18 +0000 Received: from conversion-daemon.i-mtaout7.012.net.il by i-mtaout7.012.net.il (HyperSendmail v2007.08) id <0KK300D00WXEJH00@i-mtaout7.012.net.il> for gdb-patches@sourceware.org; Sat, 23 May 2009 20:12:08 +0300 (IDT) Received: from HOME-C4E4A596F7 ([84.228.115.215]) by i-mtaout7.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KK300EUKX4862A0@i-mtaout7.012.net.il>; Sat, 23 May 2009 20:12:08 +0300 (IDT) Date: Sat, 23 May 2009 17:13:00 -0000 From: Eli Zaretskii Subject: Re: [RFA] Fix documentation of snprintf and vsnprintf In-reply-to: <4A180840.3040004@gmail.com> To: Dave Korn Cc: gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <837i07u4k7.fsf@gnu.org> References: <83d4a0szry.fsf@gnu.org> <4A180840.3040004@gmail.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-05/txt/msg00518.txt.bz2 > Date: Sat, 23 May 2009 15:29:20 +0100 > From: Dave Korn > CC: gcc@gcc.gnu.org, gcc-patches@gcc.gnu.org > > I think it's still a little bit unclear: > > > +This function is similar to @code{sprintf}, but it will write at most > > +var{n} bytes (including the terminating null byte) to @var{buf}. > > It could still be perceived as ambiguous. That sentence says that the > terminating null byte is included in the count of > "the-most-bytes-it-will-write", but it doesn't explicitly say that it won't be > truncated off like the rest of the characters if the output is too long. I thought it did say that, as "write at most N bytes (including the terminating null byte)" means that it will write no more than N bytes, and those N bytes include the null byte. However, I don't mind the text you suggest if people think it says the same more clearly: > How about > > > +This function is similar to @code{sprintf}, but it will write at most > > +var{n} bytes (truncating the output if necessary, so that there is > > +always guaranteed to be a terminating null byte) to @var{buf}. Or maybe we should make it clearer still: This function is similar to @code{sprintf}, but it will write to @var{buf} at most @code{var{n}-1} bytes of text, followed by a terminating null byte, for the total of @var{n} bytes. WDYT?