I've inherited a C++ project at work, it's an application originally written for Windows XP that presents visual stimuli during psych experiments. I can't figure out this line here that checks for syntax errors in the control file:
else if((m_SectorSwitchData.SectorType &ET_TMS == ET_TMS) & (m_SectorSwitchData.SectorType | ET_TMS != ET_TMS))
I can't find any documentation on what the "&ET_TMS == ET_TMS" means, is it a typo? The Wikipedia page on C++ operators doesn't mention it and Visual Studio doesn't mark it wrong.
This is the bitwise and operation. To make it easier to parse you could add a space and some parentheses to make it easier to read:
(m_SectorSwitchData.SectorType & ET_TMS) == ET_TMS
Do note that this change will actually change the behavior of the code.
& has a lower precedence than
(m_SectorSwitchData.SectorType & ET_TMS == ET_TMS)
(m_SectorSwitchData.SectorType & (ET_TMS == ET_TMS))
This is mostly a mistake by the original author and
((m_SectorSwitchData.SectorType & ET_TMS) == ET_TMS)
is most likely what they intended to have.