• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How does -getLineStart:end:contentsEnd:forRange work ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >How does -getLineStart:end:contentsEnd:forRange work ? (From: email@hidden)

  • Prev by Date: Re: Network Polling
  • Next by Date: Re: Bind to element in dictionary in array
  • Previous by thread: Re: How does -getLineStart:end:contentsEnd:forRange work ?
  • Next by thread: Weird crashes since installing software update 10.4.7
  • Index(es):
    • Date
    • Thread