Re: Autorelease pool questions
Re: Autorelease pool questions
- Subject: Re: Autorelease pool questions
- From: j o a r <email@hidden>
- Date: Mon, 20 Jan 2003 15:09:55 +0100
I very much doubt that this code even compiles... You need to read and
fix the warnings that you get when you compile! Programming is a
precision art - you need to be careful with what you write, every
single character counts!
NSString *myString = [[NSSTring alloc] init];
This should of course read: [[NSString alloc] init], but I asume it's a
typo you did when transfering the code over to Mail?
NSString *myString1 = [[NSString initWithString:@"Rakesh"];
In this case you haven't balanced the parenthesis, but even if we
disregard that typo it remains that you cannot - cannot - send an init
message to the NSString class object, only to a newly created instance
(read the Obj-C PDF to learn about the difference between class- and
instance methods). That must have resulted in warnings?
Now back to your printed logs. I'm surprised that myString gives you
trouble, I would have expected it to be the other way around since the
strange large number printed for that variable looks like it's the
result of printing a non-initialized value - like I would have expected
the myString1 to be.
j o a r
On Sunday, Jan 19, 2003, at 21:08 Europe/Stockholm, Rakesh Pandey wrote:
In my code I create two NSString object like this:
NSString *myString = [[NSSTring alloc] init];
NSString *myString1 = [[NSString initWithString:@"Rakesh"];
Now I tryt to priont the retain count
NSLog(@"The retainCount for myString = %d \n And thats of myString1 =
%d",
[myString retainCount], [myString1 retainCount];
And the results is:
The retainCount for myString = 2147483647
And thats of myString1 = 1
I could not understand why is it so ?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.