|
Boost : |
Subject: Re: [boost] [Boost.Test] Assertion changes in trunk? [WAS: Call for Review: Boost.Test documentation rewrite]
From: pfultz2 (pfultz2_at_[hidden])
Date: 2014-01-23 09:35:48
> The precedence I was concerned about was not op== Thorsten, but unary op*.
>
> Apologies, my example is probably not what I meant. Here's another try:
>
> MACRO(lhs_ptr == rhs_ptr) expands to
>
> OTHER_MACRO(Catch::ExpressionDecomposer()->*lhs_ptr == rhs_ptr, ...)
>
> And since unary op* has higher precedence than op->*, I think that's
> equivalent to
>
> OTHER_MACRO(Catch::ExpressionDecomposer()->(*lhs_ptr) == rhs_ptr, ...)
>
> I.e. no longer Catch::ExpressionDecomposer::op->* and lhs, but
> Catch::ExpressionDecomposer::op->
> and (*lhs). Thus compile error? Not tried, obviously...
>
> Perhaps it doesn't matter if the only goal of ExpressionDecomposer is to
> know what operator is used by the expression, and it doesn't care about
> the
> type the template param of its op->* becomes, but in this case it looks to
> me that the 'star' will associate to lhs, not to ->. Again, I'm no C++
> expert. I'm just concerned over such trickery "just" to have a single
> macro, in Catch and more importantly here to Boost.Test. --DD
The `->*` operator is one complete operator. In C++, the operators are
decided
during lexing before the preprocessor, and they don't change(with the
exception
of the `>>` operator in C++11). Futhermore, precedence decides the order of
operators, not what the operators will become.
Paul
-- View this message in context: http://boost.2283326.n4.nabble.com/Boost-Test-Assertion-changes-in-trunk-WAS-Call-for-Review-Boost-Test-documentation-rewrite-tp4658308p4658417.html Sent from the Boost - Dev mailing list archive at Nabble.com.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk