• 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: looks like Intel vs. PowerPC difference
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: looks like Intel vs. PowerPC difference


  • Subject: Re: looks like Intel vs. PowerPC difference
  • From: Bill Bumgarner <email@hidden>
  • Date: Thu, 3 Aug 2006 13:49:50 -0700


On Aug 3, 2006, at 11:53 AM, Matt Neuburg wrote:

I have to say that I agree with Sherm on this. It isn't just this call. I
have recently rewritten ALL my code where there is a double-pointer like
this whose value I am going to check afterwards, and guess what - when I
supply a known value (e.g. nil) at the outset, a bunch of mysterious
misbehaviours went away. Example:


    NSError* err = nil; // <--- LOOK!
    NSXMLDocument *xmlDoc = [[NSXMLDocument alloc]
      initWithContentsOfURL:url options:0 error:&err];
    [xmlDoc autorelease];
    if (err) // etc.

Nope -- there are no mysteries here. The above is incorrect.

You should not *ever* be poking at (err) unless xmlDoc is nil. That xmlDoc is nil indicates that err was set to an error.

The NSXMLDocument class is free to do whatever it wants to err, including setting it to a completely bogus state, if the xmlDoc was correctly parsed and produced. It might be that the xmlDoc sets the reference pointed to by &err to an allocated instance of NSError that is -release'd upon successful completion, but the reference is not "cleared" because there is no reason to do so.

Same thing goes for various Core Data and other AppKit methods that take an (NSError **) argument.

b.bum



_______________________________________________
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


  • Follow-Ups:
    • Re: looks like Intel vs. PowerPC difference
      • From: Jakob Olesen <email@hidden>
    • Re: looks like Intel vs. PowerPC difference
      • From: John Stiles <email@hidden>
References: 
 >Re: looks like Intel vs. PowerPC difference (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: Crash on [NSApp endSheet]
  • Next by Date: Re: Pull-down NSPopUpButton with checked item?
  • Previous by thread: Re: looks like Intel vs. PowerPC difference
  • Next by thread: Re: looks like Intel vs. PowerPC difference
  • Index(es):
    • Date
    • Thread