unused variable warnings
unused variable warnings
- Subject: unused variable warnings
- From: Phrygian <email@hidden>
- Date: Wed, 12 Feb 2003 10:05:37 -0500
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. I can open projects (say, from the learning cocoa set) that use the
one-line initializers, and they seem to compile without warning. If I start a
new project, or add a one-liner initializer to an existing .m file, I seem to
get the compiler warning about unused variables. I've browsed documentation,
searched all the archives I could find, and can't find any logical reason as to
why this is happening. I've recently updated to the december2002 tools, and the
default setting for compiler is gcc 3.1. I've tried is with the july2002 tools
as well, on another machine, and I get the same behavior. I am using Jaguar
(10.2.3) on both machines. I'm guessing this is a subtle setting I am missing,
and someone on theses lists will know of -- or have dealt with this problem
before.
Thanks,
P
_______________________________________________
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.