Re: Warnings with NSError **
Re: Warnings with NSError **
- Subject: Re: Warnings with NSError **
- From: Pontus Ilbring <email@hidden>
- Date: Fri, 16 Dec 2005 18:03:03 +0100
On 12/16/05, Jonathon Mah <email@hidden> wrote:
>
Hi all,
>
>
I have a class with a few convenience constructors which take an
>
NSError ** as a parameter:
>
>
>
+ (id)patchWithContentsOfFile:(NSString *)path error:(NSError **)
>
outError
>
{
>
return [[[self alloc] initWithContentsOfURL:[NSURL
>
fileURLWithPath:path] error:outError] autorelease];
>
}
>
>
- (id)initWithContentsOfURL:(NSURL *)patchURL error:(NSError **)outError
>
{ // Stuff }
>
>
>
The 'return' line always generates a warning:
>
passing argument 2 of 'initWithContentsOfURL:error:' from distinct
>
Objective-C type
>
>
I've tried explicitly casting outError to (NSError **) and a couple
>
of other things. I'm using GCC 4.0.1 (it also happened on 4.0.0).
>
>
What can I do to silence the warning?
+ (id)patchWithContentsOfFile:(NSString *)path error:(NSError **)outError
{
return [[(MyClass *) [self alloc] initWithContentsOfURL:[NSURL
fileURLWithPath:path] error:outError] autorelease];
}
The type of [self alloc] is id, so the compiler can't tell if it is
supposed to use NSAppleScript's initWithContentsOfURL:error: or your
without explicit casting.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden