#error and BOOST_STATIC_ASSERT

B

Barry

Alex said:
Hi,

#error enables the user to print user-supplied text but doesn't print
__FILE__ and __LINE__.

diagnostic message produced by "#error " depends on implementation
BOOST_STATIC_ASSERT prints __FILE__ and __LINE__ but doesn't enable to
to print user-supplied text .

BOOST_STATIC_ASSERT produces compile error message (which often includes
line information).

refer to:
http://www.boost.org/doc/libs/1_35_0/doc/html/boost_staticassert/how.html

in C++0x, static_assert would be implemented as language core,
see Comeau Online tryout, or the current GCC
Is there any method to print both __FILE__/__LINE__ and user-supplied
text in compile-time?

IIRC, Loki's implementation uses macro joining to produce a new name for
error message.

in C++0x, static_assert /would/ be implemented as language core,
see Comeau Online tryout, or the current GCC.
 
F

Fokko Beekhof

There is a nice trick that works for assert, maybe it'll work for
static_asserts too:

assert( (x < 3) && "x must be smaller than 3!" );
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top