Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!ihnp4!inuxc!pur-ee!uiucdcs!ccvaxa!aglew From: aglew@ccvaxa.UUCP Newsgroups: net.lang.c Subject: Re: enums, pcc & all that Message-ID: <2600065@ccvaxa> Date: Thu, 19-Jun-86 09:51:00 EDT Article-I.D.: ccvaxa.2600065 Posted: Thu Jun 19 09:51:00 1986 Date-Received: Sat, 21-Jun-86 12:34:44 EDT References: <212@pyuxv.UUCP> Lines: 28 Nf-ID: #R:pyuxv.UUCP:212:ccvaxa:2600065:000:974 Nf-From: ccvaxa.UUCP!aglew Jun 19 08:51:00 1986 In this discussion of enums, I thought I'd mention a quick and pleasant tool. I don't know if it has been mentioned before - hell, I might have mentioned it! but it is useful: I get tired of seeing #define MASK1 0x01 #define MASK2 0x02 #define MASK3 0x04 ... #define MASKN 0x8000000 and even the corresponding enum is a pain. So, a filter that expands enum_mask { MASK1, MASK2, MASK3 ... MASKN } into the appropriate series of #defines or enums is useful. Of course, I realize that this violates the type rule; or, rather, I need to declare a type which is a Cartesian product of the masks. And that really should be a struct. Unfortunately, many compilers are too dumb to recognize that lots of tiny bit field operations in a struct really can be done with a single logical operation. Too bad. Andy "Krazy" Glew. Gould CSD-Urbana. USEnet: ihnp4!uiucdcs!ccvaxa!aglew 1101 E. University, Urbana, IL 61801 ARPAnet: aglew@gswd-vms