Re: More Mac like handling of OS raised exceptions
Re: More Mac like handling of OS raised exceptions
- Subject: Re: More Mac like handling of OS raised exceptions
- From: Mike Blaguszewski <email@hidden>
- Date: Tue, 16 May 2006 14:16:27 -0400
On May 16, 2006, at 1:46 PM, Lon Giese wrote:
AND this is a big big big AND the kernel CANNOT detect when your
process overruns one variable and clobbers another variable if both
are within your owned memory space. Consequently, no signal is
generated and your app goes on its merry way saving corrupted data
and feeding bad info to the user... where's the kernel now when you
really need it?
Methinks you're expecting a bit too much of the kernel. This is up to
the language runtime and libraries (which know of such things as
arrays and objects) to handle. And Obj-C/Cocoa does, almost all the
time. Aside from memory management, there's only a few operations,
like extracting data from NSData, that tend to cause problems.
My advice to you would be to add a category to NSData that does
bounds checked accesses (or use getBytes:range:). And avoid using
unsafe C APIs whenever possible. You can also avoid many memory
management bugs by using a higher-level language (e.g. Python with
PyObjC). By the time your bug generates an EXC_BAD_ACCESS, it's too
late to do much about it.
--
Mike Blaguszewski / Cocoa Hacker / Ambrosia Software, Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden