[Home]Segmentation fault

HomePage | Recent Changes | Preferences

Showing revision 4
Darn. I need a really good explanation of this. Time to look at google.

Isn't a seg fault related to trying to access memory not allocated to the program? I know that you can get a seg fault if you try to access a higher value than allocated for an array (or a negative value for that matter).

I think this is true, which means one can do all sorts of really cool abusive things depending on how large the pages are and how they are laid out. My question comes from abusing pointers in strlen to extract array sizes without carrying around stupid size variables all the time. I would have though that strlen should have segfaulted on some code I passed it, but it worked. Thus I need an exact definition of seg fault. google produces too many hits (a googol no doubt) too many to filter through.

Anyone up for this? The above go to Talk later.

strlen doesn't seg fault because all strings are terminated with the '\0' character, so all strlen needs is the start of the string and it can find the end.


HomePage | Recent Changes | Preferences
This page is read-only | View other revisions | View current revision
Edited November 6, 2001 11:45 am by 165.123.179.xxx (diff)
Search: