Problem with true=-1.....


!false=1



So !false == true fails which can bite you in the behind unexpectedly....



true= 1
!true=0
true=-1
!true=0
!false=1
(true= 1 == !false) = 1
(true=-1 == !false) = 0



#include <stdio.h>
main()
{
        int true1=1;
        int true2=-1;
        int false=0;
        printf("true= 1\n!true=%d\n",!true1);
        printf("true=-1\n!true=%d\n",!true2);
        printf("!false=%d\n",!false);
        printf("(true= 1 == !false) = %d\n",true1==!false);
        printf("(true=-1 == !false) = %d\n",true2==!false);
}





Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems

________________________________
>>That is interesting to know, I tend to use -1 as true (misspent youth
>>dabbling in Forth on 8 bit machines).

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to