Q2 - POSIX says:
Quote:
WEXITSTATUS(stat_val)
If the value of WIFEXITED(stat_val) is non-zero, this macro evaluates to the low-order 8 bits of the status argument that the child process passed to _exit() or exit(), or the value the child process returned from main().
The lower eight bits of something is never 256 -- 8 bits range from 0 - 255. First. Did you check WIFEXITED?
the >> question: I do not know, but I do know function arguments are sequence points. That means they have to be fully evaluated before they are passed as argument to a function.
Are you using an old compiler, like the one that comes as part of HPUX?
Q1- sys/types.h is required to be included first by wait(), followed by sys/wait.h - if you read the man page for wait.
The real reason is so that test macros in the other include files do not "accidentally" turn off a declaration of some datatype, struct or typedef needed by somebody in another include file later on.