Re: newbie EXC_BAD_ACCESS
Re: newbie EXC_BAD_ACCESS
- Subject: Re: newbie EXC_BAD_ACCESS
- From: Hamish Allan <email@hidden>
- Date: Tue, 22 Mar 2005 02:51:35 +0000
I am trying to accomplish the same thing using the private accessors I originally had. Here's how I think it works....
while looping in progress
allocate memory for sd (sd retainCount = 1)
scan the info
set the instance variables type and desc
add sd to knownStrokes (via the addStrokeDesc method)
(sd retainCount = 2)
Ah, okay. See my previous email to Charilaos.
release sd (retainCount = 1)
My biggest surprise in your solution was the use of + for a class method. Kochan doesn't seem to do that much in his examples, so it never occurred to me to try. Maybe the real question I need to ask is:
- When should I go for a class method as opposed to instance method? In other words, is there some significant difference between your approach:
+ (int)type desc:(NSString *)desc
..... return [sd autorelease]
and something like
- (id)initStrokeDescriptionWithType:(int)type desc:(NSString *)desc
..... return [self autorelease] // or just return self ???
Yes, just return self, because this is an init method (did I mention that? Anyway you seem to have understood it).
Best wishes,
Hamish
_______________________________________________
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