Re: can I catch an EXC_BAD_ACCESS?
Re: can I catch an EXC_BAD_ACCESS?
- Subject: Re: can I catch an EXC_BAD_ACCESS?
- From: Jonas Maebe <email@hidden>
- Date: Sun, 25 Jun 2006 18:52:20 +0200
On 25 Jun 2006, at 06:17, Ladd Van Tol wrote:
It would seem to me that writing code that relies on being able to
catch memory protection violations is incorrect. It's not portable
It's portable to all OS'es which support protected memory of which I
know. It's by definition portable to all OS'es which support the
POSIX standard (i.e., pretty much every *nix out there, including Mac
OS X and Linux), and it also works under Windows (32 and 64 bit) and
even Dos (with a protected mode extender).
Further, writing code that stomps on or reads memory that it
doesn't own is generally considered to be bad programming practice.
I think that in general it's rather used to catch programming errors
(and to report a nice error to the user in that case) than as
something which is expected to happen all the time. For example, the
default handler inserted by our compiler writes out a backtrace (with
symbol information if you turn on debugging information) when any
sort of exception happens.
Another cases is dynamic instrumentation, when you don't know whether
you are actually disassembling valid code and following something of
which you think it's a jump may guide you into neverneverland. Or
when you want to trace all memory operations (and write out the value
of the memory locations they access), but don't want to throw an
exception inside your tracing routine (so you catch invalid accesses
there and ignore them, and let the actual memory access instruction
throw the exception instead).
And at least the Jikes Research Virtual Machine relies on the
hardware to catch nil pointer exceptions (so it doesn't have to check
each pointer before it dereferences them).
Jonas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden