[PATCH] remove unnecessary cast to bool
Michael Adam
obnox at samba.org
Thu Mar 3 16:27:48 UTC 2016
On 2016-03-03 at 17:08 +0100, Ralph Boehme wrote:
> On Thu, Mar 03, 2016 at 05:02:57PM +0100, Michael Adam wrote:
> > Review/push appreciated.
> >
> > Thanks for the hint. Ralph!
>
> sorry, didn't mean to nitpick! This just made me curious...
>
> For the archives, it seems
>
> bool foo = 16 & 24;
>
> is valid C99, because
>
> 6.5.16.1,2:
> "In simple assignment (=), the value of the right operand
> is converted to the type of the assignment expression…"
>
> and
>
> 6.3.1.2:
> "When any scalar value is converted to _Bool, the result is 0 if the
> value compares equal to 0; otherwise, the result is 1"
>
> Language lawyer end. :)
Not sure if this counts as a RB+ ;-)
Michael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20160303/835e5a0b/signature.sig>
More information about the samba-technical
mailing list