C Bitfields in D

Jonathan M Davis jmdavisProg at gmx.com
Tue Dec 7 00:58:56 PST 2010


Okay. I'm trying to get some C code to be properly callable from some D code, 
which naturally involves some extern(C) blocks. One of the types that I have to 
deal with looks something like this:

    typedef struct
    {
        unsigned i:1;
    } my_struct;

I have no idea how to do such a bitfield in D. Does a std.bitmanip.bitfield work? 
I wouldn't have thought so, but I don't know. What would be the proper way to 
create a properly compatible struct in D?

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list