• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Disabling some compiler warnings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Disabling some compiler warnings (From: Lloyd Sargent <email@hidden>)

  • Prev by Date: Use of NSLog() for debugging
  • Next by Date: Drag and Drop with the + cursor (again)
  • Previous by thread: Re: Disabling some compiler warnings
  • Next by thread: Currency Converter sample [rateField selectText:self]; doesn't work...?
  • Index(es):
    • Date
    • Thread