From: Johan Paulsson (boost.org_at_[hidden])
Date: 2006-11-10 15:43:45
David Abrahams wrote:
> Johan Paulsson <boost.org_at_[hidden]> writes:
>> In this case, with the compilers I used, I do not see a big difference
>> in quality of the error message.
> Of course not, especially because in this case you seem to have left
> out all but the very useless ASSERT(false) case.
I made a different, in my opinion much better, test for compile time
assertions in recursive templates. I put together a small web-page with
source code and output from some compilers.
Please have a look at <http://www.kuodo.com/code/assert/recurse/readme.html>
Or download it (9kb) <http://www.kuodo.com/code/assert/recurse/recurse.zip>
The test can be made to instantiate templates to a certain depth, and
compile time assertions can be set to fail when a certain depth is
instantiated, in class and/or function scope.
The compiler back-trace shows the instatiation-depth (a int template
argument), at least on the compilers I have used.
In this case, I do see a difference with the Intel compiler. My
implementation does not point to the line of the compile-time assert
typedef. That is not very nice.
The output says:
../recurse.hpp(27): error: class "tests::too_deep_in_function<5>" has no
If it said 80 instead of 27 it would point to the compile-time assert
David, I think this is what you said in a previous message?
>>> 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.
>> I agree, I should have left it out of the compiler output.
> So why did you throw out the only assertion that can possibly show
> useful results?
I think the output from the class-scope assertion that is included in
the compiler output is useful, thogether with the source code for the test.
I wanted to show, as briefly as possible, the basic usage of my
implementation compared to something the readers of this mailing list
would recognize. I think it does. It was not my intention to prove one
implementation better than the other, or provide a very useful test, and
I think I never implied that. Anyway, I am sorry you found it useless.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk