From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10934 invoked by alias); 8 May 2007 15:11:13 -0000 Received: (qmail 10873 invoked by alias); 8 May 2007 15:11:03 -0000 Date: Tue, 08 May 2007 15:11:00 -0000 Message-ID: <20070508151103.10872.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libstdc++/21334] Lack of Posix compliant thread safety in std::basic_string In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "james dot kanze at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-05/txt/msg00611.txt.bz2 ------- Comment #37 from james dot kanze at gmail dot com 2007-05-08 16:11 ------- Subject: Re: Lack of Posix compliant thread safety in std::basic_string On 7 May 2007 21:08:05 -0000, gianni at mariani dot ws wrote: > ------- Comment #35 from gianni at mariani dot ws 2007-05-07 22:08 ------- > Is this really a bug ? Any discussion in the upcoming standardization of > threads that talks about calling a non-const begin() on a std::string ? > If we take James's code and replace the "g" definition like so: > std::string g_modifyable ; > const std::string & g = g_modifyable; > ... there is no race condition. > Who said that calling begin() on a non const std::string > should be thread safe ? Posix and common sense. Just as using a char* (rather than a char const*) to access a char[] is thread safe. But let's not start that again. The ISO committee is discussing the issue, and will doubtlessly decide one way or another. (Before they get that far, they have to agree on what a thread means:-).) In the meantime, all of the other implementations work (but have other disadvantages); the g++ implementation doesn't. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21334