Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2006-11-08 11:31:21

"John Maddock" <john_at_[hidden]> writes:

> Johan Paulsson wrote:
>> I wrote:
>>> Below is the compile-time assert I use.
>>> Would it be a useful addition to Boost?
>> To make it easier to digest, I put together a minimal web page with
>> - Source code
>> - A test
>> - Compiler errors from the test, using different compilers (It's
>> supposed to make compiler errors). Compiler errors from the same test
>> is
>> also included, to make it easy to compare.
>> I think the benefits of my compile time assert is:
>> - No macros

I don't think that's a very significant advantage.

>> - No compiler-specific implementation
>> - It's easy to make useful error-messages
>> Please have a look at <>
>> Or download it (12kb) <>
> Frankly it's hard to choose between them on error message quality (which is
> to say none are all that good).

I think you'd see a much bigger difference in quality if there were a
deep instantiation backtrace. With the MPL asserts, the failing
condition shows up in the error message itself, rather than in a
backtrace frame, which (on GCC for example) can be far, far away from
the top of the output.

Also, the first test, which simply asserts a bool constant, is not
very interesting from an error-message-quality point of view. You
can't expect much useful information from such an assertion; it's
similar to


at runtime.

Dave Abrahams
Boost Consulting

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