Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site pyuxv.UUCP Path: utzoo!watmath!clyde!burl!ulysses!gamma!pyuxww!pyuxv!cim2 From: cim2@pyuxv.UUCP (Robert L. Fair) Newsgroups: net.lang.c Subject: Boolean datatypes Message-ID: <210@pyuxv.UUCP> Date: Thu, 12-Jun-86 19:22:24 EDT Article-I.D.: pyuxv.210 Posted: Thu Jun 12 19:22:24 1986 Date-Received: Mon, 16-Jun-86 16:38:45 EDT Organization: CHC Lines: 23 At the risk of being flamed, I've been using enums for a proper boolean datatype for years: typedef enum { false=0,true } bool; bool flag=false; if(!flag) ... This has _lots_ of advantages over the usual #defines - especially with a decent compiler which will barf on constructs like: flag=10; /* correct syntax error,10 is neither true nor false */ or enum states {activate,inactive,comatose} state; flag=state; /* correct syntax error - a state isn't a boolean */ Many current C compilers now implement enums properly (i.e. each enumeration is a distinct type) yet they are hardly ever used. Any comments why not ? Rob Fair Bell Communications Research ihnp4!pyuxv!cim2