[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtkmm
Subject:    Re: [gtkmm] conversion int->bool and bool->int
From:       Daniel Elstner <daniel.elstner () gmx ! net>
Date:       2001-12-28 19:10:52
[Download RAW message or body]

Am Fre, 2001-12-28 um 19.53 schrieb Karl Nelson:
 
> > However, someone might say TRUE isn't necessarily == 1.  But checking
> > for (int_value == TRUE) is discouraged anyway, and I cannot imagine any
> > system that wouldn't #define TRUE to 1.  And both of those nasty ideas
> > together is something we shouldn't try to make work.  Really.
> 
> Actually on some systems (now extinct systems) "true" as in the result 
> >from a (1==1) is -1 so that (1==1)&2 would not be 0.  Though I think 
> the standards stamped this practice out years ago.     Unless we have
> some overwhelming reason to have TRUE!=1!=true then I think we should
> remove the extra junk.

Yep.  In standard C++, the result type of a logical expression is bool. 
So (1==1)&2 is actually int(1==1)&2, and therefore relies on the
implicit bool-to-int conversion anyway.

--Daniel


_______________________________________________
to unsubscribe or change your subscription parameters :
https://lists.sourceforge.net/lists/listinfo/gtkmm-main
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic