Return-Path: Delivered-To: apmail-incubator-stdcxx-dev-archive@www.apache.org Received: (qmail 48224 invoked from network); 8 Feb 2006 01:45:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 8 Feb 2006 01:45:44 -0000 Received: (qmail 40343 invoked by uid 500); 8 Feb 2006 01:45:44 -0000 Delivered-To: apmail-incubator-stdcxx-dev-archive@incubator.apache.org Received: (qmail 40327 invoked by uid 500); 8 Feb 2006 01:45:44 -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 40316 invoked by uid 99); 8 Feb 2006 01:45:44 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Feb 2006 17:45:44 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [12.17.213.84] (HELO bco-exchange.bco.roguewave.com) (12.17.213.84) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Feb 2006 17:45:43 -0800 Received: from [10.70.3.113] (10.70.3.113 [10.70.3.113]) by bco-exchange.bco.roguewave.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2657.72) id ZGW28R0W; Tue, 7 Feb 2006 18:37:43 -0700 Message-ID: <43E94E29.3010101@roguewave.com> Date: Tue, 07 Feb 2006 18:49:29 -0700 From: Martin Sebor User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20050920 X-Accept-Language: en-us, en MIME-Version: 1.0 To: stdcxx-dev@incubator.apache.org Subject: Re: test for lib.alg.sort References: <43E8C8E1.8040401@moscow.vdiweb.com> In-Reply-To: <43E8C8E1.8040401@moscow.vdiweb.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Anton Pevtsov wrote: > Martin Sebor wrote: > >> <>> It looks to me like the sort and stable_sort tests are completel > > >> <>independent of the partial sort tests, correct? If that's so, could you >> please split the test into two? It will make them easier to > >> maintain and prevent errors in one from affecting the results of the >> other. > > > Yes, the attached files contains separated tests for sort and > partial_sort algorithms. Thank you! It's in: http://svn.apache.org/viewcvs.cgi?rev=375776&view=rev > > Martin Sebor wrote: > >> <>[...] > > >> <>> Here's a little program that should demonstrate what I mean. Note >> that > > >> the replacement operator new and delete don't work across shared library > > >> <>boundaries on AIX and Windows. It would be > nice to find an >> equivalent solution that does work there (or at least on Windows). Some >> kind of malloc() hook maybe -- any ideas? >> > Hmm, hooks seems to be a tricky and platform-dependent solution. Replacement operator new and delete are standard C++. That they don't work across shared library boundaries on AIX and Windows is a limitation (bug, IMO) of those platforms. The only reason why C++ compiler vendors on those platforms get away it is because the standard fails to address (even acknowledge) the existence of shared libraries. > May be it is possible to add the "logged" (as in the test driver) new > and delete operators into the library itself and switch to them using > some define? That wouldn't work. The replacement operators must not be inline and they must be defined at most once in a program. What would work is replacing all calls to these operators made by the library (within .cpp files or headers) with a call to some library function and providing a mechanism to hook into this function (e.g., a callback). In fact, there already is a pair of functions kind of like that (__rw_allocate() and __rw_deallocate()) although they aren't used throughout the library. Though a change to make them used instead of the remaining calls to new and delete would be pretty easy. It would be a useful enhancement. That said, there ought to be a non-invasive solution to the problem besides replacing operators new and delete that we could employ in the test driver. Some platforms provide hooks for debugging malloc. MSVC has its _malloc_dbg() and _free_dbg() that we could use instead (that would be a useful enhancement to rwt_checkpoint() and friends). I don't know if there is something similar on AIX but if not, we might just have to accept the fact that there might be platforms where we can't do this kind of thing. Martin