From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2559 invoked by alias); 15 Aug 2004 19:16:52 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 2550 invoked by uid 48); 15 Aug 2004 19:16:51 -0000 Date: Sun, 15 Aug 2004 19:16:00 -0000 From: "pcarlini at suse dot de" To: gcc-bugs@gcc.gnu.org Message-ID: <20040815191648.17038.pcarlini@suse.de> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug libstdc++/17038] New: ABI impacting issue in time_put X-Bugzilla-Reason: CC X-SW-Source: 2004-08/txt/msg01454.txt.bz2 List-Id: This is an internal reminder: most probably we have to change _M_put to return an integer, otherwise we'll be never able to succesfully complete the output when the buffer is too small (> 64 chars, currently). These notes in the glibc docs about strftime (and wcsftime) will be useful in dealing correctly with the issue: The SIZE parameter can be used to specify the maximum number of characters to be stored in the array S, including the terminating null character. If the formatted time requires more than SIZE characters, `strftime' returns zero and the contents of the array S are undefined. Otherwise the return value indicates the number of characters placed in the array S, not including the terminating null character. _Warning:_ This convention for the return value which is prescribed in ISO C can lead to problems in some situations. For certain format strings and certain locales the output really can be the empty string and this cannot be discovered by testing the return value only. E.g., in most locales the AM/PM time format is not supported (most of the world uses the 24 hour time representation). In such locales `"%p"' will return the empty string, i.e., the return value is zero. To detect situations like this something similar to the following code should be used: buf[0] = '\1'; len = strftime (buf, bufsize, format, tp); if (len == 0 && buf[0] != '\0') { /* Something went wrong in the strftime call. */ ... } If S is a null pointer, `strftime' does not actually write anything, but instead returns the number of characters it would have written. -- Summary: ABI impacting issue in time_put Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P2 Component: libstdc++ AssignedTo: pcarlini at suse dot de ReportedBy: pcarlini at suse dot de CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: Any http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17038