Skip navigation.
 
mlRe: looks like Intel vs. PowerPC difference
FROM : Bill Bumgarner
DATE : Thu Aug 03 22:49:50 2006

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

Related mailsAuthorDate
mllooks like Intel vs. PowerPC difference Andrei Tchijov Aug 3, 19:37
mlRe: looks like Intel vs. PowerPC difference Sherm Pendley Aug 3, 20:04
mlRe: looks like Intel vs. PowerPC difference Shawn Erickson Aug 3, 20:11
mlRe: looks like Intel vs. PowerPC difference Andrei Tchijov Aug 3, 20:22
mlRe: looks like Intel vs. PowerPC difference Matt Neuburg Aug 3, 20:53
mlRe: looks like Intel vs. PowerPC difference Bill Bumgarner Aug 3, 20:55
mlRe: looks like Intel vs. PowerPC difference Sherm Pendley Aug 3, 21:05
mlRe: looks like Intel vs. PowerPC difference Bill Bumgarner Aug 3, 22:49
mlRe: looks like Intel vs. PowerPC difference John Stiles Aug 3, 22:55
mlRe: looks like Intel vs. PowerPC difference Kay Roepke Aug 3, 23:41
mlRe: looks like Intel vs. PowerPC difference Jakob Olesen Aug 3, 23:52
mlRe: looks like Intel vs. PowerPC difference Bill Bumgarner Aug 4, 00:05
mlRe: looks like Intel vs. PowerPC difference Kay Roepke Aug 4, 00:09
mlRe: looks like Intel vs. PowerPC difference Matt Neuburg Aug 4, 00:44
mlRe: looks like Intel vs. PowerPC difference Bill Bumgarner Aug 4, 00:53
mlRe: looks like Intel vs. PowerPC difference Matt Neuburg Aug 4, 04:05
mlRe: looks like Intel vs. PowerPC difference Nat! Aug 5, 18:03