Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!gistdev!flint From: flint@gistdev.gist.com (Flint Pellett) Newsgroups: comp.lang.c Subject: Re: TRUE and FALSE (or true and false) Message-ID: <1000@gistdev.gist.com> Date: 3 Sep 90 21:22:58 GMT References: <11215@alice.UUCP> <514@demott.COM> <2316@cirrusl.UUCP> <3835@sactoh0.SAC.CA.US> <26280@mimsy.umd.edu> <708.26dd1bf9@iccgcc.decnet.ab.com> Organization: Global Information Systems Technology Inc., Savoy, IL Lines: 33 I've received mail from a couple people flaming me for not reading/knowing that C evaluates booleans to 0/1, when I commented that using the named constants ZERO/ONE for boolean values was a bad idea. They missed my point. I apparently also missed Rahul's point/ sarcasm-- sorry. The fact that C evaluates booleans to 0 or 1 and always will has very little to do with what I said in my posting. They have assumed that a boolean is only useful to be evaluated by C, and that is NOT true. (As has been demonstrated in other notes here, using it for purposes other than assigning vars from it is generally not good.) It is quite possible that a program is written which contains variables used to tell a TRUE/FALSE result, where none of those variables are ever used in a comparison within the program itself. For example, those truth values may only be stored away in some database that is read by a different program. If the different program is C right now, you'll define TRUE=1 and FALSE=0. Next year, you may rewrite the different program in some other language where TRUE is 0, and FALSE is 1, (maybe because some contract requires a certain language for some parts of the system), change the database structure, and you would then have to redefine the constants in your C program. Having a "#define ONE 0" in my code is not something I would want. (This also has nothing to do with the argument about how good/bad it is to have TRUE/FALSE defined because they can be misused by ignorant programmers. __Properly used__, a simple and easy to compile 0/1 set of constants works.) -- Flint Pellett, Global Information Systems Technology, Inc. 1800 Woodfield Drive, Savoy, IL 61874 (217) 352-1165 uunet!gistdev!flint or flint@gistdev.gist.com