"Andrej Mitrovic" <[email protected]> wrote in message 
news:[email protected]...

> enum MouseAction
> {
>    press,
>
>    release,
>
>    alias click = press,  // does not reset the counter!
>
>    double_click,  // equals release + 1
> }
>
> Does the alias member feature pull its weight? Or is it overkill and
> we should drop it?
>

Honestly, it seems like overkill to me.

I can understand it would be an annoying bug to hit, but I doubt it would be 
that common.

Two strategies that will prevent this bug are:

1) Put the 'alias' members directly after the member they reference
2) Put the 'alias' members at the end

A possible alternative would be to warn/error on having two implicitly 
initialized enum members that get the same value.

eg

enum E
{
  a,
  b,
  c = a,
  d,  // Warning: Enum member E.d has been automatically assigned the same 
value as E.a
}

tl;dr I don't think this justifies a new feature.  A lint rule, absolutely. 
A warning, possibly.  But not a new feature. 


Reply via email to