enum

deadalnix deadalnix at gmail.com
Wed Apr 9 19:20:08 PDT 2014


On Thursday, 10 April 2014 at 00:40:21 UTC, Jonathan M Davis 
wrote:
> But it _isn't_ going to be a valid enum value. IMHO, a function 
> which is
> taking or-ed flags where those flags are enums needs to take 
> uint or ulong or
> whatever the base type of the enum is and _not_ the enum type. 
> For instance,
> the fact that std.socket has functions which have a SocketFlags 
> parameter is
> fundamentally broken, because the values passed aren't going to 
> be valid
> values of SocketFlags unless you just so happen to pass only 
> one of them
> rather than or-ing multiple.
>

Indeed, it is an unknown enum value. The whole problem come from 
the fact that we try to have one thing do two things (ie a set of 
value and a set of orable values).

Fairly certain the second use case can be implemented as a 
library and do not need language support.


More information about the Digitalmars-d mailing list