This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __builtin_expect for indirect function calls
- From: rridge at csclub dot uwaterloo dot ca (Ross Ridge)
- To: gcc at gcc dot gnu dot org
- Date: Sun, 6 Jan 2008 15:41:40 -0500 (EST)
- Subject: Re: __builtin_expect for indirect function calls
Mark Mitchell writes:
> What do people think? Do we have the leeway to change this?
If it were just cases where using __builtin_expect is pointless that
would break, like function overloading and sizeof then I don't think
it would be a problem. However, it would change behaviour when C++
conversion operators are used and I can see these being legitimately
used with __builtin_expect. Something like:
struct C {
operator long();
};
int foo() {
if (__builtin_expect(C(), 0))
return 1;
return 2;
}
If cases like these are rare enough it's probably an acceptable change
if they give an error because the argument types don't match.
Ross Ridge