Re: Core Data debugging
Re: Core Data debugging
- Subject: Re: Core Data debugging
- From: Bill Bumgarner <email@hidden>
- Date: Thu, 16 Jul 2009 13:58:35 -0700
On Jul 16, 2009, at 1:37 PM, Kyle Sluder wrote:
This makes many people's lives difficult. It's kinda bogus that if I
pass in the address of a pointer-to-NULL and receive back a YES that I
have to turn around and re-NULL that pointer before reusing it. Many
AppKit methods have a tendency to set the *error argument to 0x8 when
they return YES, causing havoc with our error-wrapping macros.
Then your macros are buggy.
Given:
NSError *foo;
result = [moc save: &foo];
(1) if the result is NO, the value of foo is undefined.
(2) If result is YES, foo *must* be set to a valid NSError
(3) -save: *must not* assume anything about foo; must not treat it is
a valid pointer to anything.
Setting foo to NULL before the call is a wasted instruction. Checking
foo for NULL after the call doesn't make sense since you have to test
result to know if foo was set.
For completeness, the above is distinct from [moc save: NULL]; -save:
does check for a NULL and the common optimization is to not create an
NSError at all.
b.bum
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden