www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - wanna bitflags support

reply "Katayama Hirofumi MZ" <katayama.hirofumi.mz gmail.com> writes:
bitflags WINSTYLEBITFLAGS : uint
{
WS_VISIBLE = 1,
WS_CHILD = 2,
...
}

bool CreateWindow(WINSTYLEBITFLAGS styles);

static assert(typeid(WS_VISIBLE) == typeid(WINSTYLEBITFLAGS));
static assert(typeid(WS_CHILD) == typeid(WINSTYLEBITFLAGS));
static assert(typeid(WS_VISIBLE | WS_CHILD) == 
typeid(WINSTYLEBITFLAGS));

How do you consider about this?
Feb 09 2014
parent reply "bearophile" <bearophileHUGS lycos.com> writes:
Katayama Hirofumi MZ:

 How do you consider about this?
I think the D language is probably able to implement something like that in Phobos code, like the bitfields. Bye, bearophile
Feb 09 2014
parent reply "Katayama Hirofumi MZ" <katayama.hirofumi.mz gmail.com> writes:
There is no bitfield support in dlang. Could you show any example?
Feb 09 2014
parent "Jakob Ovrum" <jakobovrum gmail.com> writes:
On Sunday, 9 February 2014 at 13:48:08 UTC, Katayama Hirofumi MZ 
wrote:
 There is no bitfield support in dlang. Could you show any 
 example?
std.bitmanip.bitfields should be able to do it.
Feb 09 2014