[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LSU.2.11.1501112257580.10101@nerf60.vanv.qr>
Date: Sun, 11 Jan 2015 23:23:01 +0100 (CET)
From: Jan Engelhardt <jengelh@...i.de>
To: Richard Weinberger <richard@....at>
cc: Joe Perches <joe@...ches.com>,
Netfilter Developer Mailing List
<netfilter-devel@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Networking Developer Mailing List
<netdev@...r.kernel.org>
Subject: Re: [PATCH 3/3] x_tables: Factor out 16bit aligment
ifname_compare()
On Sunday 2015-01-11 22:30, Richard Weinberger wrote:
>>>> Perhaps this would be better as bool ifname_compare
>
>Anyway, I agree with Linus wrt. bool.
>https://lkml.org/lkml/2013/8/31/138
Had the function return "bool", it would have been obvious enough
what to do with its return type. A return type of "int" might have
hinted towards negative-is-error (in general) or strcmpish values
(functions doing string compare work).
Now that it returns "unsigned long", one is pressed to look at the
function body (not bad per se, but it is a hump) for the return
value's semantics.
Linus says bool is dangerous to the unsuspecting user — but so is
"volatile", microwave ovens, etc. If the kernel really cared for
entry-level coders, it would be written in something like MISRA C.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists