Boost logo

Boost :

From: Kevlin Henney (kevlin_at_[hidden])
Date: 2000-06-29 05:40:50


In message <NBBBJLGGGJHHEPEPKBFCKEGLFMAA.paquette_at_[hidden]>, Jeffrey
D. Paquette <paquette_at_[hidden]> writes
>>Whichever way we go, I would prefer to keep both forms as cast-like as
>>possible. Feelings on this?
>
>Why not go with existing practice and write:
>
> a = interpret_cast<A>(b, std::nothrow);
>
>for the non-throwing version?

Although I have seen this proposed, my main reservation is that it
doesn't look like a cast -- none of the built-in casts take two
operands.

Perhaps it should be in the name, eg interpret_cast_nothrow? Or maybe
even a scoped setting, eg a guard object can be used to change the
behaviour in a given block or expression. Or is that too subtle? Hmm, if
that were used, it could perhaps offer a way of resolving precision
issues that were raised:

        {
                interpreting params(std::nothrow, some_precision);
                ... interpret_cast<A>(b) ...
                ... interpret_cast<C>(d) ...
        }

The most obvious objection I can come up with against this is the
threading issue. As a threading model has not yet been established for
boost, there is no way to deal with thread-specific data portably.

Thoughts?
____________________________________________________________

  Kevlin Henney phone: +44 117 942 2990
  Curbralan Ltd mobile: +44 7801 073 508
  kevlin_at_[hidden] fax: +44 870 052 2289
____________________________________________________________


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk