Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site gitpyr.UUCP
Path: utzoo!linus!gatech!gitpyr!robert
From: robert@gitpyr.UUCP (Robert Viduya)
Newsgroups: net.lang.c
Subject: Re: Cryptic C
Message-ID: <675@gitpyr.UUCP>
Date: Wed, 21-Aug-85 11:24:57 EDT
Article-I.D.: gitpyr.675
Posted: Wed Aug 21 11:24:57 1985
Date-Received: Fri, 23-Aug-85 06:04:35 EDT
References: <2913@ncsu.UUCP> <709@brl-tgr.ARPA> <1056@mtgzz.UUCP>
Organization: Georgia Tech, Atlanta
Lines: 29
Summary: boolean enum?  wasted storage.

In article <1056@mtgzz.UUCP>, dsk@mtgzz.UUCP (d.s.klett) writes:
> 
> Instead of using #defines for the boolean values, I
> would rather see enumerated data types used.  In general,
> C programmers seem to prefer #defines to defining a data
> type that can be checked during compilation.
> 
> 	typedef enum { False , True } Boolean;
> 
> Don Klett

The problem with enums is that compiler allocate them as ints.  This
means 1 wasted byte on a machine with a 16-bit int, 3 wasted bytes on
a machine with a 32-bit int and so on and so forth.  All you really
need is 1 byte (on most conventional machines).  I personally prefer:

    #define	TRUE	1
    #define	FALSE	0
    typedef	char	bool;


				robert
-- 
Robert Viduya							01111000
Georgia Institute of Technology

UUCP:   {akgua,allegra,amd,hplabs,ihnp4,masscomp,ut-ngp}!gatech!gitpyr!robert
        {rlgvax,sb1,uf-cgrl,unmvax,ut-sally}!gatech!gitpyr!robert
BITNET:	CCOPRRV @ GITVM1