Boost logo

Boost :

From: Beman Dawes (beman_at_[hidden])
Date: 1999-11-05 10:35:22


Gavin Collings wrote:
>
>> Indeed, I would go even further and make it consistent with the
comment
>> in the boost documentation, "Is this intended, or is it a coding
error".
>> Surely, the correct approach is to promote the warning to an
error, if
>> the compiler supports it.
>
>Hold on a minute, let's take a step back. What is the purpose of
implicit_cast?
> "Is this intended, or is it a coding error" seems to indicate that
it is giving
>the programmer a chance to say that he knows it's intended, and
furthermore, he
>knows from context that it won't generate a numeric range error. In
that case,
>the current behaviour (disable warnings) is correct. Essentially,
it's a kind
>of optimised numeric_cast without the run-time checks.

Yes, you are right about one intended usage. But implicit_cast has
other usages like pointer casts, so the optimized numeric_cast might
better be handled by something more specific. But as Paul Moore
pointed out:

>My view is that having too many flavours of cast can be as bad
(confusion
>potential) as having too few. We're teetering on the edge, here.

--Beman


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