[PATCH] remove unnecessary cast to bool

Ralph Boehme slow at samba.org
Thu Mar 3 16:08:54 UTC 2016

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,2:
"In simple assignment (=), the value of the right operand
is converted to the type of the assignment expression…"

"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. :)


More information about the samba-technical mailing list