Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 1999-08-31 10:56:32


I think the heart of the matter is this: do we wish to enforce that Boost
authors may not use the standard assert macro?

If yes, then we need a replacement. If no, it is less important.

From: Kevlin Henney <Kevlin.Henney_at_[hidden]>
> It's not to say that one can't resolve the issue, but the question is,
> do we wish to impose a single development style on others just because
> they wish to use polymorphic_cast or numeric_cast? I would hope not.

No, we do not wish to, but we may have to. Although "impose a single
development style" seems a harsh characterization of "define NDEBUG, or
not, in accordance with the standard".

> To get it right, we would have to mandate that all of their source code
> (and that can be a lot) was compiled consistently w/ or w/o NDEBUG set
> -- goodbye to the benefits of separate compilation :-( -- and that this
> includes any libraries they themselve used, which may or may not be
> under their control. This level of intrusion would be a heavy price to
> pay for using these casts!

Does anyone know how C99, which now has inline functions, handles this
problem, if it does?

> It doesn't really matter whether or not a compiler diagnoses ODR, you
> can still get ODR problems: it is the violation not the diagnosis that
> is the root of the problem. I have come across a couple of instances
> where ODR violation has lead to problems -- the absence of ODR diagnosis
> has just meant that it took longer to find, but it didn't mean the
> problem wouldn't arise.

Yep. For instance, if you take the address of a function, and get two
copies of the function when you expected one, because of different assert
definitions.

> I am not sure that relaxing ODR for assert is an issue: it has no
> linkage! The issue arises for functions that use it, and as far as I can
> see there is no standard way one could do it. The last thing one would
> want to see in the standard is an extra paragraph at the end of section
> 3.2 stating "BTW, anything that uses assert is exempt from all of the
> above. The behavior is implementation defined." :-}

I'm not anticipating a change in the standard, just some compiler magic.
Perhaps that is too much to ask.


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