Hello,

The online docs at
http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Other-Builtins.html
has a confusing (to me) example of __builtin_expect. Could someone take a look at this?

<start quote from above-referenced page>
  Since you are limited to integral expressions for exp, you should
  use constructions such as

          if (__builtin_expect (ptr != NULL, 1))
            error ();
<end quote>

This seems backwards.    The return value of __builtin_expect
is the first argument, namely (ptr != NULL), which presumably is true in the NON-error case. The following example might be more helpful:

          if (__builtin_expect (ptr == NULL, 0))
            error ();

Apologies if I'm not reading this correctly.

-Jim

Reply via email to