[PATCH] remove unnecessary cast to bool

Ralph Boehme rb at sernet.de
Fri Mar 4 20:33:33 UTC 2016


On Fri, Mar 04, 2016 at 08:33:33PM +0100, Michael Adam wrote:
> On 2016-03-03 at 17:27 +0100, Michael Adam wrote:
> > 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+ ;-)
> 
> Did it? :-)

sure! Just forgot to push. :)

-Ralph

-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de,mailto:kontakt@sernet.de



More information about the samba-technical mailing list