[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using __builtin_expect (likely/unlikely macros)

From: Paul Eggert
Subject: Re: Using __builtin_expect (likely/unlikely macros)
Date: Thu, 18 Apr 2019 10:27:40 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 4/18/19 6:47 AM, Andy Moreton wrote:
> Please don't use this macro, as it makes the code much less readable.
> It is reasonable to have a macro that combines the '_Noreturn' and
> 'ATTRIBUTE_COLD' decorations, but that should not be combined with the
> return type.

Actually I first tried it the way that you suggested, but found that
having a single macro improved readability for me, partly because
_Noreturn functions don't return anything so their return type doesn't
matter except for static type checking. 'AVOID' lets a traditionalist
reader easily see that the type 'void' is intended, while also connoting
that the function is rarely used because calls to it are normally
avoided. (I tried to shoehorn "cold" and "does not return" into the
macro's name too, but couldn't come up with anything better than

reply via email to

[Prev in Thread] Current Thread [Next in Thread]