Boost logo

Boost :

From: Kevlin Henney (Kevlin.Henney_at_[hidden])
Date: 1999-09-01 12:30:09


Greg Colvin wrote:
[...]
> Rather than leave them as they are, should we consider the pruning of
> the cast operators so that there are no ODR problems at all? I
submitted
> a copy of numeric_cast to Beman at the weekend, and since this is a
new
> operator perhaps we could start with that: a single form that throws
an
> exception.
>
> Kevlin

I know we disagree here, so let me make the disagreement stark:

   There are no ODR problems with assert.

     Sorry, I should have been more explicit: assert in inlines and
     templates offers an easy invite to ODR violations. This does not mean
     the invitation is always accepted, but it does mean that it is always
     there.

It is possible that users can create ODR problems by attempting
to define NDEBUG at too fine a level of granularity. The safest
way to define NDEBUG is all or nothing, which is, in your opinion,
an imposition. But it is is not, in my opinion, a good enough
reason to avoid using assert, given its other virtues.

     I regard assert as having few enough virtues that this does not bother
     me :-> Exposing a library to the problems we have described does not
     make a good enough case for keeping assert.

     Kevlin


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