[OpenWrt-Devel] [BUG] lantiq: net: wrong operator

Bjørn Mork bjorn at mork.no
Sun Feb 17 09:41:32 EST 2019


"Kevin 'ldir' Darbyshire-Bryant" <ldir at darbyshire-bryant.me.uk> writes:

>> it looks indeed wrong. And looking more closer at the lines, I don't
>> get why we need the double negation.
>
> Having seen this code structure before, it’s a non-obvious way of
> turning a masked and hence value based true/false into a binary 0 or 1
> result: Exhibit A moronic demo c programme:

Huh?  The double negation is a pretty standard way to convert an integer
to a boolean. It's used a few times in the kernel for example:

  bjorn at miraculix:/usr/local/src/git/linux$ git grep '!!('|wc -l
  3449


Fix the && => & bug and leave the !!.


Bjørn

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list