I am testing a sample fragment that I found as an answer to another question
However, the compiler spits out this "Operator && cannot be applied to operands of type long and bool". Why is he doing this? When I read the code, it says: "If the mask and resolution are greater than 0 return success bool"
Am I reading this wrong?
(Also, no one called it a bad example, so I expected it to work. Not that I was an encoder to copy).
bool CheckMask( long Mask, long TestPermission ) {
return Mask && TestPermission > 0;
}
long mask = 4611686844973976575;
const long MASK_ViewListItems = 0x0000000000000001;
bool HasPermission_ViewListItems = CheckMask(mask, MASK_ViewListItems);
const long MASK_UseClientIntegration = 0x0000001000000000;
bool HasPermission_UseClientIntegration = CheckMask(mask, MASK_UseClientIntegration);
There are a lot of similar questions in StackOverflow, and I clicked through most of them, there is a large list to my right. No one applied my situation, at least I managed to see the connection between the answers and my problem.