__builtin_expect

Richard Henderson rth@twiddle.net
Sat Apr 22 16:02:00 GMT 2000


On Fri, Apr 21, 2000 at 10:19:02AM -0700, Ulrich Drepper wrote:
> In glibc this means __builtin_expect should be used everywhere the
> results of comparisons etc is statically predictable.  At the very
> least it should be used for error handling.  E.g.;
> 
> 	ptr = malloc (size);
> 	if (ptr == NULL)

Note that gcc's built in estimate_probabilities function is supposed
to get this right -- eq with NULL predicted false.

It doesn't hurt to mark it anyway though...


r~


More information about the Libc-hacker mailing list