I have this C++ code in one of my programming books:
WNDCLASSEX wndClass = { 0 };
wndClass.cbSize = sizeof(WNDCLASSEX);
wndClass.style = CS_HREDRAW | CS_VREDRAW;
What does the single pipe do in C++ windows programming?
Bitwise OR operator. It will set all bits true that are true in either of both values provided.
For example CS_HREDRAW
could be 1 and CS_VREDRAW
could be 2. Then it's very simple to check if they are set by using the bitwise AND operator &
:
#define CS_HREDRAW 1
#define CS_VREDRAW 2
#define CS_ANOTHERSTYLE 4
unsigned int style = CS_HREDRAW | CS_VREDRAW;
if(style & CS_HREDRAW){
/* CS_HREDRAW set */
}
if(style & CS_VREDRAW){
/* CS_VREDRAW set */
}
if(style & CS_ANOTHERSTYLE){
/* CS_ANOTHERSTYLE set */
}
See also:
|
is called bitwise OR operator.
||
is called logical OR operator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With