Did you ever tried to do man something… and the manual pages are simply not installed in the machine?
Now there’s a quick solution. Just use the online manpages, available from the Ubuntu Documentation.
Soon or later, your Linux developed C/C++ code will generate a SISEGV signal and your application will miserably crash. This signal is generated when a program tries to read or write outside the memory that is allocated for it, or to write memory that can only be read. (Actually, the signals only occur when the program goes far enough outside to be detected by the system’s memory protection mechanism.) The name is an abbreviation for “segmentation violation”.
In order to improve your program, and terminate in a controlled way, you can register a custom function to handle such signal. The following example shows the leave function that is called whenever a SIGSEGV signal is launched.
#include
#include
void leave( int s ) {
std::cout << "FATAL: Leaving due to SIGSEGV." << std::endl;
exit( s );
}
int main() {
// Register SIGSEGV handler!
signal( SIGSEGV, leave );
// originate a SIGSEGV
double array[20];
std::cout << array[10000] << std::endl;
return 0;
}