On 09/07/2011 01:42 PM, Jonathan M Davis wrote:
On 09/07/2011 01:27 PM, Timon Gehr wrote:

Oh, btw:

final switch(Mode.read|Mode.write){
      case Mode.read: writeln(1); break;
      case Mode.write: writeln(2); break;
}

=>  2

hm...

Actually, it will print nothing, not even an Assertion failure, my enum definition was wrong


Personally, I don't think that&ing or |ing enums should result in an enum,
and this case illustrates one reason why. But ultimately, the main issue IMHO
is that&ing or |ring enums doesn't generally result in a valid enum value, so
it just doesn't make sense.


Yes exactly. That is why I always use

alias int MODE;
enum:MODE{
    MODEread=1,
    MODEwrite=2,
}











Reply via email to