[cygnus.project.sid] branch probability hinting

Andrew Haley aph@redhat.com
Thu Mar 1 01:23:00 GMT 2001


Tom Tromey writes:
 > I've always thought the __builtin_expect code in libgcj was a bit
 > ugly.  I find it hard to read and understand.
 > 
 > I think we ought to adopt macros like the appended.

I think the macros should be used in parens:

   if UNLIKELY(error)

is non-idiomatic C.

   if (UNLIKELY(error))

is better IMO.  Otherwise this is a good idea; I've never liked the
builtin_expect syntax much.

Also please everyone note that the compiler already knows that

   if (p == NULL)

is unlikely, so let's not obfuscate our code unnecessarily.

Andrew.



More information about the Java mailing list