473,467 Members | 1,596 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

#error and BOOST_STATIC_ASSERT

Hi,

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

Is there any method to print both __FILE__/__LINE__ and user-supplied
text in compile-time?
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn
Jun 27 '08 #1
2 2113
Alex Vinokur wrote:
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...ssert/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.
Jun 27 '08 #2
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!" );
Barry wrote:
Alex Vinokur wrote:
>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...ssert/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.
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: AIM | last post by:
Error in msvc in building inheritance.obj to build hello.pyd Hello, I am trying to build the boost 1.31.0 sample extension hello.cpp. I can not compile the file inheritance.cpp because the two...
5
by: Tony Wright | last post by:
Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information...
1
by: Aravind | last post by:
we have two files: 1. rc4.c (defines one function "create_pin()") 2. MyImpl.c(calling the function "create_pin()"),This implements JNI method. 1.When I am trying to create .dll file with one...
1
by: yanwan | last post by:
I met this problem in executing a c++ project in visual studio. Does anyone have suggestions to resolve "error lnk 2001"? --------------------Configuration: reconstruction - Win32...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
5
by: tthunder | last post by:
Hi @all, I am looking for a good (compiler-independent) way to generate meaningful error messages, if specific (unintended) templates are instantiated. e.g. ------------
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.