Re: Disabling some compiler warnings
Re: Disabling some compiler warnings
- Subject: Re: Disabling some compiler warnings
- From: Lloyd Sargent <email@hidden>
- Date: Fri, 20 Jul 2001 18:13:36 -0500
From: Rainer Brockerhoff <email@hidden>
Subject: Re: Disabling some compiler warnings
From: Graham Wihlidal <email@hidden>
Subject: Re: Disabling some compiler warnings
Yes there is. Go to your build target and select Build Settings.
Scroll down to the listbox with Expert Build Settings. In the
OTHER_CFLAGS field put -w
On Sunday, July 15, 2001, at 11:58 AM, email@hidden wrote:
Is there a way to disable some unuseful warnings of the compiler? For
instance, I have a class with:
IBOutlet id delegate;
and then in implementation:
[delegate someAction];
The compiler says:
Warning: cannot find method
Warning: return type for 'someAction' defaults to id
Well how would it be possible to find a method for an 'id', anyway? If
I declare the object as id, I already know that the compiler cannot
check at runtime, so it is just noise. Moreover, I don't mind the
return type, since I don't use it (the method is called as a
procedure;
actually it's a void one in my case). this is something that the
compiler could check before issuing the warning!
Disabling all warnings seems a little extreme - sometimes the warnings
_are_ meaningful.
In such a case, I usually cast the delegate to the class which
implements "someAction":
[(theClass*)delegate someAction];
and the compiler is satisfied.
This also IMHO is somewhat more self-documenting...
--
Rainer Brockerhoff <email@hidden>
I have to agree with Rainer. Although you can eliminate the warnings
with the -w, it is probably just as easy to add an include file and cast
it to the correct class. I've been shot in the foot one times too many
by ignoring "harmless" warnings.
My two cents (or nickle if they do away with the penny).
Cheers,
Lloyd
-----
Canna Software Development
"No animals were harmed in the creation of this email, however some
routers suffered painful bumps and bruises."
OS X Release Version - As Good As It Gets!