incubator-stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <>
Subject Re: test for lib.alg.min.max
Date Tue, 14 Feb 2006 01:10:23 GMT
Anton Pevtsov wrote:
> The attached file contains the tests for the lib.alg.min.max algorithms
> (min, max, min_element, max_element).

Great, thanks! Here's the commit:

A couple of comments below...

> template <class T, class Predicate>
> void test_min_max (int              line,
>                    const char       a,
>                    const char       b,
>                    const T*,
>                    const Predicate *ppred,
>                    bool             min)

I renamed min to test_min to avoid colliding with the min macro
that is sometimes (incorrectly) #defined on Windows.

> {
>     _RWSTD_UNUSED(ppred);

This is unnecessary -- ppred is being used.

>     rw_assert (exp_res == res.val_ && exp_id == res.origin_, 0, line,
>                "line %d %s <%s%{?}, %s%{;}> (%#c, %#c) returned "
>                "value %#c, id %d; expected value %#c, id %d",
>                __LINE__, fname, tname, ppred, funname, a, b,

You need 0 != ppred (or !!ppred) and not just ppred above. ppred is
a pointer but the %{?} directive extracts an int from the argument
list. On 64-bit platforms where pointers are 64-bits wide and ints
are only 32 bits (i.e., all sane platforms), the function would
extract only half the argument leaving the other half for the next


View raw message