Paste: blah

Author: blah
Mode: c++
Date: Sat, 23 Mar 2013 17:25:50
Plain Text |
#include <sys/types.h>
enum Flags {
    F_0 = 0x01,
    F_1 = 0x02,
};

int main() {
    u_int8_t opt = 0;
    opt |= F_0;

    if ((opt & (F_0 | F_1)) == F_0)
        return 0;
    return -1;
}

---

struct Flags {
    bool F_0 : 1;
    bool F_1 : 1;
}; 

int main() {
    struct Flags f = {1,0};
    if (f.F_0 == 1 && f.F_1 == 0)
        return 0;
    return -1;
}

New Annotation

Summary:
Author:
Mode:
Body: