开发者

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

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

This question does not appear to be about programming within the scope defined in the help center.

Closed 4 years ago.

Improve this question

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 bitm开发者_开发技巧ask? 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.


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


"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.


The .NET framework has a Flags attribute that is used to indicate exactly the behavior you're describing.

They don't exactly just make up names for whatever they want, so a flag is probably the most acceptable term.


I've also seen "bit flags".


In mathematics, a singleton set is a set with exactly one element, so you could conceivably call them a singleton bitset or singleton bitmask, but I haven't seen this in practice.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜