Re: unused variable warnings
Re: unused variable warnings
- Subject: Re: unused variable warnings
- From: Lindsey Spratt <email@hidden>
- Date: Wed, 12 Feb 2003 09:33:20 -0600
On Wednesday, February 12, 2003, at 09:05 AM, Phrygian wrote:
Hello Cocoa Programmers,
I'm at a loss as to why I keep getting an "unused variable"
compiler error
in project builder under the following conditions,
NSString * somestring = @"this is a string";
or
NSCalendarDate * today = [NSCalendarDate calendarDate];
the compiler will give a warning that somestring and today are unused
variables.
However, if I do the following,
NSString * somestring;
somestring = @"this is a string";
or
NSCalendarDate * today;
today = [NSCalendarDate calendarDate];
all is well.
It looks to me like the warning is correct in the first case,
'somestring' and 'today' *are* unused (and the compiler should have
given you a warning in the second case, but it's not that
sophisticated). Why create a variable that you never reference?
Lindsey Spratt
http://homepage.mac.com/lspratt
_______________________________________________
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.