Re: Disabling some compiler warnings
Re: Disabling some compiler warnings
- Subject: Re: Disabling some compiler warnings
- From: Art Isbell <email@hidden>
- Date: Fri, 20 Jul 2001 14:18:33 -1000
On Friday, July 20, 2001, at 01:13 PM, Lloyd Sargent wrote:
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.
You definitely don't want to hide compiler warnings. I used to
turn on additional warnings, in fact. This warning is issued for a good
reason. You haven't imported a header file that declares the method
that you're invoking or you've misspelled the method name. You really
don't want to wait until runtime to crash when an unknown message is
attempting to be sent.
You want to fix this as Lloyd suggested by importing an appropriate
header file, but it isn't usually necessary to cast the receiver (this
isn't Java, you know :-) The exception to this is when more than one
class implements methods with the same selector but different method
signatures. This will generate a different compiler warning that should
clearly indicate that more than one method was found, and that the
compiler picked a certain one to use. In that case, you should cast so
the compiler knows which method to use.
Art Isbell
Apple iServices Technical Support
http://www.apple.com/iservices/webobjectssupport/
+1-808-591-0836