M
mijoryx
Does anyone have a good basis upon which to
prefer using bit-fields for true/false settings
or a big integer with macros for each power
of two?
eg.
struct {
unsigned exec: 1;
unsigned read: 1;
unsigned write: 1;
} flag;
flag.exec = 1;
if (flag.exec) {...}
vs.
unsigned flag;
#define Fexec 1
#define Fread 2
#define Fwrite 4
flag |= Fexec;
if (flag & Fexec) {...}
Is it just a matter of punctuation?
luXer-ex-troXX
prefer using bit-fields for true/false settings
or a big integer with macros for each power
of two?
eg.
struct {
unsigned exec: 1;
unsigned read: 1;
unsigned write: 1;
} flag;
flag.exec = 1;
if (flag.exec) {...}
vs.
unsigned flag;
#define Fexec 1
#define Fread 2
#define Fwrite 4
flag |= Fexec;
if (flag & Fexec) {...}
Is it just a matter of punctuation?
luXer-ex-troXX