Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Name for a bitmask with 1-bit set [closed]

Tags:

c

embedded

naming

In C and embedded, one frequently uses enumerated constants where every value is a bit mask with exactly 1-bit set. (e.g. 0x0001, 0x0002, 0x0004, etc.) Is there a standard name for this type of bitmask? I've seen them referred to as flags, but more in passing than as a standard definition. I know it sounds snobbish, but "flags" doesn't really seem technical enough? Does anyone else have a good name for these? I can't imagine that noone has come up with one.

like image 287
ktrimbach Avatar asked Jul 18 '10 00:07

ktrimbach


2 Answers

"Flags" is the accepted term. "Pass down a flag", "set this flag", etc.

like image 113
MSN Avatar answered Sep 23 '22 16:09

MSN


"Flag" is used for these for decades now and is just fine. My old C64 already had a zero flag, carry flag, etc. See here for further info:

http://en.wikipedia.org/wiki/Flag_(computing%29

http://en.wikipedia.org/wiki/Status_register

I don't know exactly when this term was coined and by whom.

like image 36
Secure Avatar answered Sep 25 '22 16:09

Secure