+ 1

What does the following line of code do?

// Please help me understand this line of code. Is the result the same for all computers? cout << *(int*)const_cast<char*>("\x00\x01") & 1;

3rd Apr 2018, 5:51 PM
Bebida Roja
Bebida Roja - avatar
2 Answers
3rd Apr 2018, 7:28 PM
Alex
Alex - avatar
+ 1
Whoever wrote this line is an absolute fan of type casting. const char* with hex values -> char* -> int* -> dereference and all that just to perform a bitwise AND with 1 which results in 0.
3rd Apr 2018, 7:25 PM
Alex
Alex - avatar