
2008/6/23 David Abrahams <dave@boostpro.com>:
Andrey Semashev wrote:
David Abrahams wrote:
Andrey Semashev wrote:
...snip... Probably even if we _are_ speaking of static_assert in C++0x. The problem of course is that (generalizing wildly here):
1. users don't look at the code
True, at least they don't want to.
2. users can't even locate the line where the error occurred in a long instantiation backtrace
BOOST_MPL_ASSERT does no better here.
It makes one part of the message stand out better than the others. You don't think ****************** error-message:: ********************* is more likely to get noticed and pasted into a problem report?
I agree, plus BOOST_MPL_ASSERT_MSG() does an even better job of being obvious what's gone wrong: on my computer, MSVC it adds a *full* screen of errors, with the supplied error message (such as THE_NUMBER_SUPPLIED_WAS_OUT_OF_RANGE) stuck right in the middle of it, dumped in between loads of asterisks. Because the surrounding errors are pretty consistent (AFAICT) it makes them recognisable and easier to spot. It's a pity the mpl macros are so hard to find though. It'd be nice if they were documented directly in the static assert docs. -- Darren