Article 4Y012 Explain C++ function

Explain C++ function

by
stockton
from LinuxQuestions.org on (#4Y012)
Please explain the following piece of C++ to me
void cSkymax::SetMode(char newmode)
{
m.lock();
if (mode && newmode != mode)
ups_status_changed = true;
mode = newmode;
// printf("%s %d %s %s\n", __FILE__, __LINE__, mode, newmode);
m.unlock();
}
both mode and newmode are defined as char but I am failing to see how mode && newmode can be compared to a char. Surely && returns TRUE or FALSE not a char.
I am also assuming that m.lock and m.unlock are stopping memory swopping.

The reason for my question is that I require to do this function in C not C++ and I know very little about C++latest?d=yIl2AUoC8zA latest?i=2Ce1wminFSg:n35nsp-16Vw:F7zBnMy latest?i=2Ce1wminFSg:n35nsp-16Vw:V_sGLiP latest?d=qj6IDK7rITs latest?i=2Ce1wminFSg:n35nsp-16Vw:gIN9vFw2Ce1wminFSg
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments