From dev-return-7558-apmail-stdcxx-dev-archive=stdcxx.apache.org@stdcxx.apache.org Tue May 06 19:55:07 2008 Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 77673 invoked from network); 6 May 2008 19:55:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 May 2008 19:55:07 -0000 Received: (qmail 64338 invoked by uid 500); 6 May 2008 19:55:09 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 64316 invoked by uid 500); 6 May 2008 19:55:09 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 64305 invoked by uid 99); 6 May 2008 19:55:09 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 May 2008 12:55:09 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [208.30.140.160] (HELO moroha.roguewave.com) (208.30.140.160) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 May 2008 19:54:16 +0000 Received: from nebula.bco.roguewave.com ([10.70.3.27]) by moroha.roguewave.com (8.13.6/8.13.6) with ESMTP id m46JsafI011511 for ; Tue, 6 May 2008 19:54:37 GMT Message-ID: <4820B77D.3040007@roguewave.com> Date: Tue, 06 May 2008 13:54:37 -0600 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.12 (X11/20080226) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: svn commit: r647225 - /stdcxx/trunk/tests/algorithms/25.random.shuffle.cpp References: <20080411170527.E47FC1A9832@eris.apache.org> In-Reply-To: <20080411170527.E47FC1A9832@eris.apache.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org vitek@apache.org wrote: > Author: vitek > Date: Fri Apr 11 10:05:18 2008 > New Revision: 647225 > > URL: http://svn.apache.org/viewvc?rev=647225&view=rev > Log: > > 2008-04-11 Travis Vitek > > STDCXX-783 > * tests/algorithms/25.random.shuffle.cpp (test_random_shuffle): Move > rw_assert() into loop to avoid bogus cadvise warning. > > > Modified: > stdcxx/trunk/tests/algorithms/25.random.shuffle.cpp > > Modified: stdcxx/trunk/tests/algorithms/25.random.shuffle.cpp > URL: http://svn.apache.org/viewvc/stdcxx/trunk/tests/algorithms/25.random.shuffle.cpp?rev=647225&r1=647224&r2=647225&view=diff > ============================================================================== > --- stdcxx/trunk/tests/algorithms/25.random.shuffle.cpp (original) > +++ stdcxx/trunk/tests/algorithms/25.random.shuffle.cpp Fri Apr 11 10:05:18 2008 > @@ -306,22 +306,16 @@ > 0xfa, 0xbb, 0xdd, 0xa5, 0xa3, 0x73, 0x18, 0xd9 > }; > > - bool success = true; > - std::size_t i = 0; > - for (; i != sizeof array / sizeof *array; ++i) { > - success = array [i] == result [i]; > - if (!success) > - break; > + for (std::size_t i = 0; i != sizeof array / sizeof *array; ++i) { > + const bool success = array [i] == result [i]; > + if (!success) { > + rw_assert (0, 0, line, > + "randomly shuffled sequence failed to match " > + "the expected result (data portability failure) " > + "%d != %d at %zu", > + array [i], result [i], i + 1); > + } AFAICT, this changes the behavior of the loop in a way we don't want: the loop will no longer break on the first failure and might generate dozens of lines of output. The effect I think we want is: if (!rw_assert (array [i] == result [i], 0, line, "randomly shuffled sequence failed to match " "the expected result (data portability failure) " "%d != %d at %zu", array [i], result [i], i + 1)) break; Martin