In praise of Java 1.5 enums



I tried flipping some code to use enums that used to use int.

All kinds of hard to proof read case statement methods collapsed to a
nice easy to extend list of constructor calls.

The big surprise came using the code. Almost nothing had to change but
a declaration from int to the AppCat -- the enum type. Everything
worked without a hitch first time.

The enum code is so much easier to maintain.


--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/mckinney_grills_rumsfeld.htm

Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
.



Relevant Pages

  • [git patches] net driver updates for .27
    ... static int lance_open (struct net_device *dev) ... enum mac8390_type type); ... unsigned int fifo_count, timeout, reg; ...
    (Linux-Kernel)
  • Re: why still use C?
    ... I was talking about the malloc expression, ... >>the assignment expression. ... >>enum parameter is not an error in C, but in my coding style it's a mistake). ... I took it you meant "int where an enum" is expected, ...
    (comp.lang.c)
  • Re: enums aint no good
    ... C's low level spirit. ... feels like typical ultra high level scripting language ... The compiler could not optimize an enum if it wanted to, ... int or unsigned int) are faster than operations on bytes. ...
    (comp.lang.c)
  • [PATCH 05/31] Constify struct dma_map_ops for 2.6.32 v1
    ... Constify struct dma_map_ops with some exceptions. ... extern void set_iommu_machvec; ... static inline int dma_supported ... enum dma_data_direction dir, ...
    (Linux-Kernel)
  • Re: Behaviour of enumerated types
    ... >> keys to other ordered info? ... If you want sequence numbers, ... the enum object itself can be used directly as an iterable. ... >> To me the int correspondence is as expectable and natural as ...
    (comp.lang.python)