Community
cancel
Showing results for 
Search instead for 
Did you mean: 
DLake1
New Contributor I
451 Views

identifier "__builtin_expect" is undefined

Jump to solution

identifier "__builtin_expect" is undefined

please explain.

0 Kudos
1 Solution
Judith_W_Intel
Employee
451 Views

 

This is a GNU builtin (an extension to the GNU compiler) described here:

http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

I believe we make this available in our Windows compiler (icl) as well, although Microsoft does not.

Judy

View solution in original post

6 Replies
TimP
Black Belt
451 Views

To begin with, the answers for Windows (in short, define it away) are different from those for linux or Mac.   Did any of the web search results (too many to discuss here) relate to your question?

The feature may have been added to icc to support linux kernel builds.  That doesn't mean it's a good idea to use it in your own code.

 

DLake1
New Contributor I
451 Views

I'm using Windows 7 x64 and Intel compiler v14 the code is from quicklz.c here: www.quicklz.com/download.html

Judith_W_Intel
Employee
452 Views

 

This is a GNU builtin (an extension to the GNU compiler) described here:

http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html

I believe we make this available in our Windows compiler (icl) as well, although Microsoft does not.

Judy

View solution in original post

SergeyKostrov
Valued Contributor II
451 Views
>>...I believe we make this available in our Windows compiler (icl) as well... It looks very interesting and could you specify from what ICC version is it supported?
SergeyKostrov
Valued Contributor II
451 Views
The builtin_expect is used for limit checks. Also, If interested look at GCC headers since there are lots of examples of how builtin_expect is used.
emmanuel_attia
Beginner
451 Views

This directive is perfectly usable across Linux or Windows with that kind of macro

#if defined(__GNUC__) || defined(__ICL) || defined(__clang__)
#define EXPECT(x, y) (__builtin_expect((x),(y)))
#else
#define EXPECT(x, y) (x)
#endif


Right now only Microsoft C++ does'nt support it and with ICL (Windows Intel Compiler), it is very effective (it does what it's expected to).

Reply