From stdcxx-dev-return-3811-apmail-incubator-stdcxx-dev-archive=incubator.apache.org@incubator.apache.org Tue Jun 26 18:19:04 2007 Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 73718 invoked from network); 26 Jun 2007 18:19:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Jun 2007 18:19:04 -0000 Received: (qmail 17297 invoked by uid 500); 26 Jun 2007 18:19:07 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 17238 invoked by uid 500); 26 Jun 2007 18:19:07 -0000 Mailing-List: contact stdcxx-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-dev@incubator.apache.org Received: (qmail 17214 invoked by uid 99); 26 Jun 2007 18:19:07 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2007 11:19:07 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [208.30.140.160] (HELO moroha.quovadx.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 26 Jun 2007 11:19:03 -0700 Received: from qxvcexch01.ad.quovadx.com ([192.168.170.59]) by moroha.quovadx.com (8.13.6/8.13.6) with ESMTP id l5QIIf2Y020775 for ; Tue, 26 Jun 2007 18:18:41 GMT Received: from [10.70.3.113] ([10.70.3.113]) by qxvcexch01.ad.quovadx.com with Microsoft SMTPSVC(6.0.3790.1830); Tue, 26 Jun 2007 12:17:14 -0600 Message-ID: <46815916.5000307@roguewave.com> Date: Tue, 26 Jun 2007 12:21:10 -0600 From: Martin Sebor Organization: Rogue Wave Software User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2) Gecko/20070221 SeaMonkey/1.1.1 MIME-Version: 1.0 To: stdcxx-dev@incubator.apache.org Subject: Re: [jira] Closed: (STDCXX-462) std::time_get example exposes undefined behavior References: <23869236.1182856106389.JavaMail.jira@brutus> In-Reply-To: <23869236.1182856106389.JavaMail.jira@brutus> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 26 Jun 2007 18:17:14.0156 (UTC) FILETIME=[389AFEC0:01C7B81E] X-Virus-Checked: Checked by ClamAV on apache.org Farid Zaripov (JIRA) wrote: > [ https://issues.apache.org/jira/browse/STDCXX-462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] > > Farid Zaripov closed STDCXX-462. > -------------------------------- FYI, this is a documentation bug. We need to change the code on the Class Reference page as well: http://incubator.apache.org/stdcxx/doc/stdlibref/time-get.html It sure would be nice to figure out a way to automate these updates between the example sources and the code in the docs. A couple of possible approaches are here: http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg03284.html Any other ideas? Martin > > >> std::time_get example exposes undefined behavior >> ------------------------------------------------ >> >> Key: STDCXX-462 >> URL: https://issues.apache.org/jira/browse/STDCXX-462 >> Project: C++ Standard Library >> Issue Type: Bug >> Components: Documentation >> Affects Versions: 4.1.3, 4.1.2 >> Reporter: Martin Sebor >> Assignee: Farid Zaripov >> Priority: Critical >> Fix For: 4.2 >> >> >> The example program demonstrating the use of the std::time_get facet (http://incubator.apache.org/stdcxx/doc/stdlibref/time-get.html) exposes undefined behavior. Quoting from the following post http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg03760.html: >> Martin Sebor wrote: >>> Farid Zaripov wrote: >> [...] >>>> Btw below is a part of the conforming program (taken from >>>> time_get.cpp)? >>> It's not a conforming program. The locale must stay around as >>> long as the last reference to the facet obtained from it. The >>> tests that fail to follow this rule should be changed. >>> >>>> ------------------- >>>> const std::time_get &tg = >>>> std::use_facet >(std::locale ("C")); >>>> >>>> // Display time_base::dateorder value. >>>> std::cout << "time_base::dateorder == " << tg.date_order () << >>>> ".\n"; >>>> ------------------- >>>> >>>> This fragment fails on Dinkumware STL because of tg.date_order() uses >>>> (internal) >>>> pointer to the destroyed locale object. >>> Right, and that's allowed. >