| November 16, 2008 9:51 PM PST | |
Do you need more help?
Thank you for your interest in this diagnostic message. We are still in the process of documenting this specific diagnostic.
Please let us know of your experience with this diagnostic message by posting a comment below. This will help us prioritize the order in which we document the diagnostics.
This article applies to: Intel® C++ Compiler for Linux* Knowledge Base, Intel® C++ Compiler for Mac OS X* Knowledge Base, Intel® C++ Compiler for Windows* Knowledge Base, Intel® Parallel Composer Knowledge Base
For more complete information about compiler optimizations, see our Optimization Notice.
Comments (4) 
| January 5, 2011 9:02 AM PST
Jennifer Jiang (Intel)
|
I used a chello.cpp to try the "assert()", but could not get the diagnostic to emit. I used /Od /D_DEBUG /DDEBUG t.cpp with icl 11.1 or 12.0. Can you show me a more complete test and cmd line? Thanks! |
| March 2, 2011 11:00 PM PST
Orhun |
Here is an example with visual studio 2010 command line, #include <cassert> int main() { assert(false && "This will generate an controlling expression is constant warning with Intel C++"); } >main.cpp(5): warning #279: controlling expression is constant 1> assert(false && "This will generate an controlling expression is constant warning with Intel C++"); 1> ^ Command Line : Visual Studio 2010 : (the trick is /W4) /Zi /nologo /W4 /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /EHsc /RTC1 /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fp"x64Debugit1.pch" /Fa"x64Debug" /Fo"x64Debug" /Fd"x64Debugvc100.pdb" |
| September 26, 2011 1:21 AM PDT
Luca |
Actually, this is a problem on Linux as well. If you have assert(false && "this should never happen"); you get the warning. On my platform (kubuntu 10), assert(x) essentially expands to ((x) ? 0 : __assert_fail (__STRING(x), __FILE__, __LINE__, __func__)) which means something is checking (x) without noticing that it actually came from an assertion. The real problem here is that the warning is indeed very useful IF the expression (x) does not contain only compile-time constants. In other words: look at what x is made of, if they're all compile-time constants don't warn, otherwise warn. Happy to be contacted personally on the email provided for further discussion, if you need more help. Luca |
Trackbacks (0)
Leave a comment 
To obtain technical support, please go to Software Support.
Author
Jennifer Jiang (Intel)
|


Konstantine Smaguine
assert(!"this is the text which will get displayed if this dead code branch is hit");
or
assert(x < y || !"x should be less than y here because ...");
have not found a workaround.