what does this mean?
#define WS_RECURSIVE (1 << 0)
I understand that it will define WS_Recursive (1 << 0) but what does << mean?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
<<is the left shift operator. It is shifting the number1to the left0bits, which is equivalent to the number1.It is commonly used to create flags, numbers that can be combined together with
|(bit or) and various operations can be applied to them, such as testing whether a flag is set, setting a flag, removing a flag, etc.The reason that they can be combined together without interfering with each other is that each one is a power of two, and that is the reason for using
1 << x, because that yields powers of two:1 << 0 == 20 == 1 == binary
00011 << 1 == 21 == 2 == binary
00101 << 2 == 22 == 4 == binary
01001 << 3 == 23 == 8 == binary
1000etc
You can read about bit flags here: http://www.codeproject.com/KB/tips/Binary_Guide.aspx