File: binary.yo

package info (click to toggle)
c%2B%2B-annotations 10.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,536 kB
  • ctags: 3,247
  • sloc: cpp: 19,157; makefile: 1,521; ansic: 165; sh: 128; perl: 90
file content (12 lines) | stat: -rw-r--r-- 762 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
In addition to hexadecimal hi(hexadecimal constants) integral constants
(starting with i(0x)), octal integral hi(octal constants) constants (starting
with i(0)), and decimal integral hi(decimal constants) constants (starting
with one of the digits 1..9), em(binary) integral hi(binary constants)
constants can be defined using the prefixes i(0b) or i(0B). E.g., to represent
the (decimal) value 5 the notation tt(0b101) can also be used. Formally binary
constants are supported by bf(C++) since the C++14 standard, but compilers
usually supported this well before implementing this  standard.

The binary constants come in handy in the context of, e.g., i(bit-flags), as
it immediately shows which bit-fields are set, while other notations are less
informative.