Re: [patch cr 2/4] [RFC] syscalls, x86: Add __NR_kcmp syscall v7

From: H. Peter Anvin
Date: Mon Jan 30 2012 - 16:12:50 EST


On 01/30/2012 11:58 AM, Jonathan Corbet wrote:
>
> That's a cute trick, but do we know that every compiler that will ever see
> this code will use 1 for a true integer comparison? Simply spelling it
> out with an if statement might be more robust, just as efficient, and, at
> the same time, easier for others to understand.
>

This has been the case in C from the very beginning and is guaranteed by
the C standard. The number of places which will break if this isn't
true is enormous.

-hpa

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/