Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!gatech!bloom-beacon!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: Defining TRUE and FALSE Message-ID: <6124@brl-smoke.ARPA> Date: Thu, 16-Jul-87 14:18:08 EDT Article-I.D.: brl-smok.6124 Posted: Thu Jul 16 14:18:08 1987 Date-Received: Sat, 18-Jul-87 08:09:39 EDT References: <13851@watmath.UUCP> <23052@sun.uucp> <13260@topaz.rutgers.edu> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB)) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 16 Keywords: boolean, true, false In article <13260@topaz.rutgers.edu> ron@topaz.rutgers.edu (Ron Natalie) writes: >#define isupper(c) ((_ctype_+1)[c]&_U) One could legitimately consider that to be an implementation bug, although the C spec only calls for these functions to return nonzero if true rather than 1. It does, however, prevent one from doing arithmetic on these function values without first converting them to 0/1 values (via ...!=0). This doesn't bother me too much, since I don't generally approve of arithmetic on Boolean data, but it is unnecessarily sloppy. Note that any reasonable compiler will generate the same code in cases such as "if ( isupper( c ) )" when the macro is defined as: #define isupper( c ) (((_ctype_ + 1)[c] & _U) != 0) I'm considering making this change in my version of ctype.h, much as I have already fixed up feof() and ferror() in stdio.h.