Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site rtp47.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!talcott!panda!genrad!decvax!mcnc!rti-sel!rtp47!throopw From: throopw@rtp47.UUCP (Wayne Throop) Newsgroups: net.lang.c Subject: Re: Cryptic C (YES/NO vs. TRUE/FALSE + other thoughts) Message-ID: <161@rtp47.UUCP> Date: Mon, 26-Aug-85 15:26:23 EDT Article-I.D.: rtp47.161 Posted: Mon Aug 26 15:26:23 1985 Date-Received: Wed, 28-Aug-85 10:39:31 EDT References: <2913@ncsu.UUCP>, <709@brl-tgr.ARPA> <5884@utzoo.UUCP> <989@gatech.CSNET> Organization: Data General, RTP, NC Lines: 28 In message 989@gatech, Arnold Robbins gives an interesting example: > #define FORCEWRITE 1 > #define NOFORCE 0 > > #define APPEND 1 > #define NOAPPEND 0 > > dowrite (file, FORCEWRITE, APPEND, ....); /* call */ > > int dowrite (file, force, append,...) /* actual procedure */ I like this notion in general, but I point out a problem with it that a (currently nonexistant) lint-like tool could help with. What if the call was done like so: dowrite( file, NOAPPEND, FORCEWRITE, ... ); This doesn't do remotely what you intend, and it very hard to detect. What you "really want" is to be able to declare two enumerations, and make lint check that you don't pass members of one enumeration to a formal of another type. Also, the "extra checking" that K&R says that lint-like tools are free to do with typedefs would be welcome. No current link (that I am aware of) will allow using typedef as a type abstraction device. -- Wayne Throop at Data General, RTP, NC !mcnc!rti-sel!rtp47!throopw