UNLIKELY, as it is defined in pike for gcc means just that the argument is expected to be zero. close returns 0 on success and -1 on failure, so the effect would be the same no matter how the paranthesis is places.
on the other hand, i guess that placement was not intentional and for sure placing it around the comparison is less confusing.
arne
On 05/07/15 04:00, Chris Angelico wrote:
Poking around in signal_handler.c out of curiosity, I came across this:
while(UNLIKELY(close(control_pipe[0])) < 0 && UNLIKELY(errno==EINTR)); while(UNLIKELY(close(control_pipe[1])) < 0 && UNLIKELY(errno==EINTR));
(lines 3580-3581)
The UNLIKELY marker normally applies to an entire condition, not just to the integer that's about to be compared to zero. Should this become:
while(UNLIKELY(close(control_pipe[0]) < 0) && UNLIKELY(errno==EINTR)); while(UNLIKELY(close(control_pipe[1]) < 0) && UNLIKELY(errno==EINTR));
or is there something I'm not understanding about the nature of UNLIKELY()?
ChrisA