Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-12-16 20:21:50

Sure, but Dean's point, which I agree with, is that you've just described
the nature of assert(). Furthermore, I believe I can prove that any
acceptable technique which "has no overhead in shipping builds" suffers from
exactly the same problems, and to the same extent. If you want to try to
substitute an inline function for the assert() macro, you can deal with the
ODR problem for the body of the function (the part that prints a message,
throws an exception, calls abort, whatever) by sticking the function in the
unnamed namespace. The problem remains how to get the evaluation of the
condition to be free in a shipping build without relying on the
preprocessor. There are ways, e.g. something like the lambda library, but
they seem awfully heavyweight to me.

----- Original Message -----
From: "Beman Dawes" <beman_at_[hidden]>
To: <boost_at_[hidden]>; <boost_at_[hidden]>
Sent: Saturday, December 16, 2000 6:01 PM
Subject: Re: [boost] Re: bounds checking in array.hpp

> At 07:27 PM 12/16/2000 +0000, deansturtevant_at_[hidden] wrote:
> >Another point -- boost is full of ODR violations! Any inline or
> >template code that is conditioned on some compile-time variable
> >violates the ODR, doesn't it?
> Only potentially. To avoid ODR violations, the rule-of-thumb is that the
> same preprocessor symbols are defined across all translation units of the
> program.
> --Beman

Boost list run by bdawes at, gregod at, cpdaniel at, john at