Re: #defines -> enums?

From: George Greer (greerga@circlemud.org)
Date: 08/14/01


On Tue, 14 Aug 2001, Mysidia wrote:

>> enum {
>>   ROOM_DARK = (1 << 0),
>>   ROOM_DEATH = (1 << 1),
>>   ...
>> };
>
>Why not do..
>
>enum {
>   ROOM_DARK, ROOM_DEATH, ...
>};
>
>[same for -all- other bitflags]

1) Because you can't do '1|3' and get something sane.
   (If you changed the ROOM_xx meaning to 1<<ROOM_xxx maybe, but see #2)
2) External files depend on the values so they are not arbitrary.

--
George Greer
greerga@circlemud.org

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST