On Sunday 2015-01-11 22:30, Richard Weinberger wrote:
quoted
quoted
quoted
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.