[SLOF] [PATCH slof 08/13] libnet: Compile with -Wextra

Segher Boessenkool segher at kernel.crashing.org
Fri Jan 29 03:39:18 AEDT 2021

On Thu, Jan 28, 2021 at 04:19:22PM +0100, Thomas Huth wrote:
> >+	if (!(domain == AF_INET || domain == AF_INET6))
> Better:
>        if (domain != AF_INET && domain != AF_INET6))

That is exactly the same for the compiler, so the only thing that
matters is what is easier to read and understand.  I find the latter
much worse usually (and that would be even more obvious if C had an
"unless" keyword), but of course opinions differ.

Ages ago people did De Morgan's rules manually because the compilers
of that time were not up to snuff.  That time is long past, but old
habits are hard to break.

You can go back and forth on this infinitely :-)


More information about the SLOF mailing list