Re: How does -getLineStart:end:contentsEnd:forRange work ?
Re: How does -getLineStart:end:contentsEnd:forRange work ?
- Subject: Re: How does -getLineStart:end:contentsEnd:forRange work ?
- From: Uli Kusterer <email@hidden>
- Date: Thu, 29 Jun 2006 18:21:46 +0200
Am 29.06.2006 um 16:14 schrieb email@hidden:
unsigned* startIndex=47;
unsigned* lineEndIndex=48;
unsigned* contentsEndIndex=49;
Those three don't make sense. You're declaring variables to hold
addresses and then assign arbitrary numbers to those addresses. So,
you're asking getLineStart:... to change memory addresses 47, 48 and
49, which are very likely somewhere deep in system memory and will
cause your app to get killed before it can screw up the system. You
have to declare some actual unsigned variables and point to them
using the address-of operator.
If this wasn't just a typo caused by lack of caffeine, you may want
to read some articles on memory management. It just so happens that I
wrote one:
http://www.zathras.de/angelweb/howmemorymanagementworks.htm
And there's more info on memory in my "Masters of the Void" C course
(still in progress, but what's there is at http://www.zathras.de/
angelweb/masters-of-the-void.htm) in particular in chapter 5 (http://
www.zathras.de/angelweb/masters-of-the-void-book5.htm).
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
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