Reputation: 833
The cpp documentation states,
It determines if the child process exited because it raised a signal that caused it to exit
regarding the WIFSIGNALED function. What types of situation would cause the process to do such a thing?
Upvotes: 1
Views: 136
Reputation: 754490
If you use assertions to ensure your program is correct, a failed assert
will generate a signal, SIGABRT, that causes the process to terminate. This is a deliberate case of a program signalling itself.
Accidental causes of signals could be said to include (integer) division by zero (SIGFPE, funnily enough), misaligned memory access (SIGBUS; happens if you use an odd address to access a type that must be aligned on an even address boundary — but not all systems are fussy about it), or accessing invalid memory addresses (SIGSEGV).
Upvotes: 2
Reputation: 38616
There are many signals that can cause this, further, there are a variety of ways a process can exit (i.e. with a core dump, etc.). Check out the man page on signals, specifically the section Standard signals to see a table of signals a process can receive and the default disposition for each of those signals. For a list of possible dispositions, check the Signal dispositions section towards the top.
I don't mean this as an RTFM response. That man page really does show a neat and concise table for the kinds of signals that can exit a process.
For example, there is:
SIGFPE - 8 - Core - Floating point exception
Which is sent to the process if it performs a floating point exception, for example a division by zero. This would cause your process to exit with a core dump.
Upvotes: 1