Yeah. I realized that, but my messages got reversed. Thanks.
On Apr 19, 2012, at 4:51 PM, "Black, Michael (IS)" <michael.bla...@ngc.com> wrote: > You are correct that non-zero will be treated as true. > > That's more an accident then anything else as everybody is checking "!= 0" > for true. > > > > But the values need to be consistent in the "not" cases too if you want to be > safe about it. As I demonstrated in the code. > > > > You want this to hold true, otherwise you'll get into trouble. > > > > !!a == a > > > > > > #include <stdio.h> > main() > { > int true1 = 1; > int true2 = -1; > printf("true = 1 OK? %s\n",(!!true1==true1)?"yes":"no"); > printf("true =-1 OK? %s\n",(!!true2==true2)?"yes":"no"); > } > > true = 1 OK? yes > true =-1 OK? no > > > > > > Michael D. Black > > Senior Scientist > > Advanced Analytics Directorate > > Advanced GEOINT Solutions Operating Unit > > Northrop Grumman Information Systems > > ________________________________ > From: sqlite-users-boun...@sqlite.org [sqlite-users-boun...@sqlite.org] on > behalf of Marc L. Allen [mlal...@outsitenetworks.com] > Sent: Thursday, April 19, 2012 2:56 PM > To: General Discussion of SQLite Database > Subject: EXT :Re: [sqlite] "DEFAULT BOOLEAN NOT NULL" not working with > entityframework > > I was under the impression that, in C, 0 was false, non-zero was true. > >> -----Original Message----- >> From: sqlite-users-boun...@sqlite.org [<thismessage:/>mailto:sqlite-users- >> boun...@sqlite.org] On Behalf Of Black, Michael (IS) >> Sent: Thursday, April 19, 2012 3:15 PM >> To: General Discussion of SQLite Database >> Subject: Re: [sqlite] "DEFAULT BOOLEAN NOT NULL" not working with >> entityframework >> >> 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 > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users