Differences between current version and revision by previous author of SIGSEGV.
Other diffs: Previous Major Revision, Previous Revision, or view the Annotated Edit History
Newer page: | version 8 | Last edited on Saturday, December 4, 2004 3:56:03 am | by AristotlePagaltzis | |
Older page: | version 7 | Last edited on Saturday, December 4, 2004 2:21:36 am | by PerryLorier | Revert |
@@ -1,5 +1,5 @@
-!!!Signal: Segmentation Violation (Fault
)
+!!! Signal: Segmentation Violation (SegmentationFault
)
This is raised when the program attempts has a bad memory reference such as:
* The pointer is NULL.
@@ -11,16 +11,18 @@
The default action for this signal is to cause the program to terminate and dump core.
A classic example is to dereference a pointer in [C] that is either uninitialised, or has already been freed. Here is some [C] code:
-
#include <stdio.h>
- int main(void) {
-
int *pointer;
+<verbatim>
+
#include <stdio.h>
+int main(void) {
+
int *pointer;
-
pointer = ;
+
pointer = ;
-
printf("Value pointed to by pointer is %d\n",
-
*pointer /* this will cause SEGV */
-
);
- }
+
printf("Value pointed to by pointer is %d\n",
+
*pointer /* this will cause SEGV */
+
);
+}
+</verbatim>
-See CommonProgrammingBugs for hints on how to track down memory related bugs in the source code
.
+See CommonProgrammingBugs for hints on how to track down memory related bugs in the SourceCode
.