Re: warning: assignment makes integer from pointer without a cast
Re: warning: assignment makes integer from pointer without a cast
- Subject: Re: warning: assignment makes integer from pointer without a cast
- From: Ryan Poling <email@hidden>
- Date: Tue, 16 Oct 2007 12:16:27 -0700
Thanks everyone for the replies. I had tried using a category before
posting the original message, but I had placed the @interface portion
of the category declaration *below* the @implementation of the regular
class, so as you mentioned, the compiler didn't see it in time.
Simply moving the @interface portion of the category to the top of
the .m file fixed the warning. Oops. Simple problem!
-Ryan
On Oct 16, 2007, at 10:05 AM, David Spooner wrote:
Ryan,
The problem is that the compiler hasn't encountered a declaration of
-methodThatReturnsABool, so it assumes the return type is id. You
can avoid the compiler warning by declaring a category (as John
Stiles had suggested) local to the file in which you use the method...
@interface MyClass(Private)
- (BOOL) methodThatReturnsBool;
@end
dave
On 16-Oct-07, at 10:36 AM, Ryan Poling wrote:
I'm getting the following warning and I can't figure out how to
suppress it, or whether or not I really need to worry about it.
warning: assignment makes integer from pointer without a cast
The warning is on the following line of code which calls a
*private* method (meaning that I haven't declared a prototype in
the .h file and don't want to). I imagine the compiler thinks the
method will return an id and this is why I'm getting the error, but
do I need to worry about this? I tried creating a category in the
same .m file and declaring the prototype there, but I still get the
warning. Declaring the prototype in the .h file *does* make the
warning disappear, but I'd rather not declare it there because I
don't want consumers of the interface to call it.
BOOL myBoolean = [self methodThatReturnsABool];
Any suggestions for how to correctly deal with this situation but
still leave the method private? I read online about a similar
problem when calling a delegate method and expecting a return of
type BOOL, but I'm not sure that solution applies here.
Thanks!
-Ryan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden