Name for a bitmask with 1-bit set

In C and inline, the listed constants are often used, where each value is a bitmask with exactly 1-bit set. (e.g. 0x0001, 0x0002, 0x0004, etc.) Is there a standard name for this type of bitmask? I saw that they are called flags, but more incidentally than the standard definition. I know this sounds snobbish, but the β€œflags” don't really seem technically sufficient? Does anyone else have a good name for them? I can not imagine that no one came up with this.

+7
c design embedded naming
source share
5 answers

"Flags" is an accepted term. Skip flag, set this flag, etc.

+10
source share

The flag has been used for them for several decades now, and it’s just great. My old C64 already had a zero flag, a carry flag, etc. See here for more information:

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

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

I do not know exactly when this term was coined and by whom.

+5
source share

The .NET framework has the Flags attribute, which is used to indicate exactly the behavior that you describe.

They definitely don't make up the names for what they want, so the flag is probably the most acceptable term.

+2
source share

I also saw bit flags.

+2
source share

In mathematics, a singleton set is a set with one element, so you could call them a single point bit mask or single point bit mask, but I have not seen this in practice.

+1
source share

All Articles