Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Removing a compiler warning



On Jan 31, 2004, at 4:03 PM, Greg Hulands wrote:
In an old project I have just started to bring up to date for panther I have a convention in the dealloc method to return [super dealloc]. This is in every class, so it is generating a lot of warnings. Is there a way to suppress this warning in GCC 3.3?

Attempting to return a value from a method that returns (void) really is an error. GCC3.3 is just more anal about reporting it than prior versions of the compiler, it seems.

While invoking [super dealloc] at the end of your dealloc method is definitely the correct convention, 'return [super dealloc];' is not. The warning should be treated as a bug in your code. There may be a flag to suppress such warnings, but doing so is only asking for trouble in that it is going to suppress the error in other potentially nasty situations.

Given that you likely used the exact same line of code everywhere, you should be able to easily do a global find-and-replace with Xcode. Just find 'return [super dealloc]' and replace with '[super dealloc]'.

If some hits come up in the find panel that you don't want to replace, keep in mind that you can select just the hits you want to replace. cmd-click to extend the selection in a non-contiguous fashion....

b.bum
_______________________________________________
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.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.