Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10 5/3/83; site ulysses.UUCP Path: utzoo!linus!genrad!mit-eddie!mit-vax!eagle!mhuxt!mhuxi!mhuxa!ulysses!smb From: smb@ulysses.UUCP Newsgroups: net.lang.c Subject: Re: enums Message-ID: <484@ulysses.UUCP> Date: Wed, 6-Jul-83 11:26:15 EDT Article-I.D.: ulysses.484 Posted: Wed Jul 6 11:26:15 1983 Date-Received: Thu, 7-Jul-83 12:21:37 EDT References: <108@cbosgd.UUCP> Organization: Bell Labs, Murray Hill Lines: 23 From: mark@cbosgd.UUCP Newsgroups: net.lang.c Subject: Re: enums Message-ID: <108@cbosgd.UUCP> Date: Tue, 5-Jul-83 23:08:08 EDT References: <754@rlgvax.UUCP>, <755@rlgvax.UUCP> The real reason people don't use enums in C much is that PCC is too restrictive with them. The main problem is that you can't ++ or -- them, making for loops iterating over them impossible. You also can't do < or > comparisons on enums. For example, if SIG* were made an enum, there would be no way to catch all signals. If E* (errnos) were made enums, there would be no way to check errno for a legal value. There is no way to have an array whose subscript is an enum, making it impossible to have an array of strings for perror, or an array of old values for signals. Note that Pascal's enumerations suffer from none of these problems. Enumerations in Pascal are by definition an ordered set, with the operations 'pred' and 'succ' permitted (though you can't do 'pred' on the first element, nor 'succ' on the last).