From stdcxx-dev-return-2614-apmail-incubator-stdcxx-dev-archive=incubator.apache.org@incubator.apache.org Wed Feb 14 18:58:46 2007 Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 16794 invoked from network); 14 Feb 2007 18:58:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Feb 2007 18:58:46 -0000 Received: (qmail 65793 invoked by uid 500); 14 Feb 2007 18:58:53 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 65782 invoked by uid 500); 14 Feb 2007 18:58:53 -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 65771 invoked by uid 99); 14 Feb 2007 18:58:53 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Feb 2007 10:58:53 -0800 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; Wed, 14 Feb 2007 10:58:43 -0800 Received: from qxvcexch01.ad.quovadx.com (qxvcexch01.ad.quovadx.com [192.168.170.59]) by moroha.quovadx.com (8.13.6/8.13.6) with ESMTP id l1EIw0DC015826 for ; Wed, 14 Feb 2007 18:58:01 GMT Received: from [10.70.3.113] ([10.70.3.113]) by qxvcexch01.ad.quovadx.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 14 Feb 2007 11:58:05 -0700 Message-ID: <45D35B73.4080608@roguewave.com> Date: Wed, 14 Feb 2007 11:56:51 -0700 From: Martin Sebor Organization: Rogue Wave Software User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.2pre) Gecko/20070111 SeaMonkey/1.1 MIME-Version: 1.0 To: stdcxx-dev@incubator.apache.org Subject: Re: [PATCH] Fix of STDCXX-127 References: <45D340D9.7000906@kyiv.vdiweb.com> In-Reply-To: <45D340D9.7000906@kyiv.vdiweb.com> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 14 Feb 2007 18:58:05.0771 (UTC) FILETIME=[0F5AC1B0:01C7506A] X-Virus-Checked: Checked by ClamAV on apache.org Farid Zaripov wrote: > Attached is a proposed patch for fix the bug STDCXX-127. > > ChangeLog: > STDCXX-127 > * deque (swap): Corrected _C_beg._C_node and _C_and._C_node > after swap operation for empty container. > > Farid. > Cool. Two comments on this patch (copied below): Index: deque =================================================================== --- deque (revision 507528) +++ deque (working copy) @@ -904,6 +904,30 @@ _STD::swap (_C_end, __rhs._C_end); _STD::swap (_C_nodes, __rhs._C_nodes); _STD::swap (_C_node_size, __rhs._C_node_size); + + if ( pointer() == _C_beg._C_cur + || pointer() == _C_end._C_cur) { + + _RWSTD_ASSERT ( pointer() == _C_beg._C_cur + && pointer() == _C_end._C_cur); Ft, since you assert that "if one of pointers is so must be the other" it seems to me that the condition in the if above could be simplified for efficiency to just (and the same below): if (pointer () == _C_beg._C_cur) { _RWSTD_ASSERT (pointer () == _C_end._C_cur); ... } else { _RWSTD_ASSERT (pointer () != _C_end._C_cur); } Second, since swap is not a trivial function anymore after this change (it could have been considered non-trivial even before it) we should outline it and move its definition to deque.cc. Do you agree? Martin