On Wed, 31 Aug 2016 21:28:45 -0400
David Robillard <d@email-addr-hidden> wrote:
> On Sat, 2016-08-27 at 16:49 +0100, Will Godfrey wrote:
> > I'm finding quite a lot of occasions where variables defined as 'bool' are
> > sometimes being set with true or false and other times 0 or 1. On one occasion
> > there is something like x = n + {boolean variable}
> >
> > This last one seems quite unsafe to me as I didn't think the actual value of
> > true and false was guaranteed.
> >
> > Am I being overly cautious or should I change them all to one form or the other?
>
> This is fine. The C/C++ standards guarantee that a bool, when converted
> to an integer, is 1 or 0 (the pedantically correct way of saying this
> depends on which standard/revision, but effectively that sums it up).
>
> It's pretty convenient/elegant at times. Personally, I exploit it when
> that's the case, but be more explicit if it has potential to be
> confusing.
Thanks again for the info.
-- It wasn't me! (Well actually, it probably was) ... the hard part is not dodging what life throws at you, but trying to catch the good bits. _______________________________________________ Linux-audio-dev mailing list Linux-audio-dev@email-addr-hidden http://lists.linuxaudio.org/listinfo/linux-audio-devReceived on Fri Sep 2 20:15:01 2016
This archive was generated by hypermail 2.1.8 : Fri Sep 02 2016 - 20:15:01 EEST