in reply to What A Wonderful World: Bitmasks!
More cons, in addition to chromatic's: You can only have 32 flags without requiring two flag words (64 bits on some platforms, with some compilation flags and versions of perl -- a maintance nightmare). You could accidently use the wrong flags for the puticular function you're using, and it'll simply do the wrong thing silently -- no error, no possible way to catch it.
Bitmasks absolutely have uses, don't get me wrong -- when you're in a C struct, and want to have room for expansion without making the struct larger. When space is at a premium -- if you were going to make an array of thoustands of items, using bitmasks instead of individual flag keys in a hash would make sense. But for function args, I'd use a hash of flags.
|
---|