Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site harvard.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!stew From: stew@harvard.ARPA (Stew Rubenstein) Newsgroups: net.lang.c Subject: Re: Cryptic C (YES/NO vs. TRUE/FALSE + other thoughts) Message-ID: <327@harvard.ARPA> Date: Fri, 30-Aug-85 22:12:58 EDT Article-I.D.: harvard.327 Posted: Fri Aug 30 22:12:58 1985 Date-Received: Sun, 1-Sep-85 05:48:44 EDT References: <2913@ncsu.UUCP> <709@brl-tgr.ARPA> <5884@utzoo.UUCP> <989@gatech.CSNET> <625@mmintl.UUCP> Reply-To: stew@harvard.UUCP (Stew Rubenstein) Organization: Aiken Computation Laboratory, Harvard Lines: 32 Summary: In article <625@mmintl.UUCP> franka@mmintl.UUCP (Frank Adams) writes: > >In article <989@gatech.CSNET> arnold@gatech.CSNET (Arnold Robbins) writes: > > >Well, this can get carried too far. I have worked with code based on > >Software Tools stuff that looks like > > > > dowrite (file, YES, NO, NO, YES); >... > > dowrite (file, FORCEWRITE, APPEND, ....); /* call */ > > > > > >is much clearer than the first style. This is the kind of thing, if > >anything, that "enums" would be most useful for (no flames about how poorly > >enums are implemented. I'm talking conceptually here.). > >The problem with your solution is I can just easily write > > dowrite(file, APPEND, NOFORCE, ...) > >and will have a terrible time finding the error. This is where Ada wins: > > dowrite(file, append=>true, force=>false, ...) In a perfect world, the argument types for dowrite() would be declared as different enum types and the compiler will complain if you mix them up (i.e. in new ANSI C if I understand it right). In a slightly less perfect world, lint would complain about the inconsistency. We were talking conceptually, right? Not to say that the keyword style isn't better, but this is one the compiler ought to catch. Stew