I was doing an exercise for university where I had to return a value with exit, that value was actually a count of something. This could be above 255 (which exit() can\'t ha
Here 0xff00 is a binary mask (link text). ANDing it with a value sets all bits to zero, except the second byte (counting from the right).
You should only use WEXITSTATUS on a process which is known to have exited normally. This information is given by the WIFEXITED macro.
And the real question in this topic, is the same thing to call this macro in my code as dividing by 256?
The macro makes the code more readable, and it's guaranted to work on any Posix-compliant implementation. As far as I know Posix doesn't specify the format of the status, so you can't expect your code to work everywhere.