I am testing the WIFEXITED to see if a child process exited abnormally or normally. According to documentation, it should return a non-zero status for a child process that terminated normally.#include <wait.h>#include <unistd.h>#include <iostream>#include <sys/types.h>int main(int argc, const char* const* argv) {    int *pointer=NULL;    int status;    pid_t pid=fork();    if (pid==0) {        std::cout << Child is:  << getpid() << std::endl;        if (argc>1) {            std::cout << getpid() << Going to crash myself << std::endl;            *pointer=1; //Segmentation fault as of null pointer dereference        }        else            pointer=NULL; //Safe code    }    else {        std::cout << Parent is:  << getpid() << std::endl;        pid_t terminated=waitpid(-1, &status, 0);        std::cout << Child  << terminated <<  exited ;        if (WIFEXITED(status)) std::cout << GOOD;        else {             std::cout << BAD;             // Is it worth here to also check for WIFSIGNALED or is it redundant?        }        std::cout << std::endl;    }    std::cout << getpid() <<  exiting normally << std::endl;    return 0;}To test a normal exit, call it without arguments, and an abnormal exit with segmentation fault, call it with some parameters.Furthermore, if I use WIFSIGNALED it detects correctly the bad status, then, what's the use for WIFEXITED?Is it advisable to use only WIFEXITED, or do you advise also to use WIFSIGNALED for further checks? Is this combination useful or redundant?
WIFEXITED combined with WIFSIGNALED
c++;child process;unix