Re: Conflicting Namespaces on the Language Level
Re: Conflicting Namespaces on the Language Level
- Subject: Re: Conflicting Namespaces on the Language Level
- From: email@hidden
- Date: Sat, 14 Sep 2002 20:46:56 -0400
The plot thickens!
It would appear that I oversimplified the example. Try this:
you'll notice:
1. Changed the superclass to the class that is causing problems.
2. Put the code into a category (actually the code works in this
example
if the method that contains the error is put into the class
implementation).
3. The same problem occurs if all of the NSDictionary stuff is
replaced with NSArray
stuff (dictionary ==> array...).
#import <Cocoa/Cocoa.h>
@interface ClassThatShouldCompile: NSDictionary
{
id dictionary;
}
@end
@implementation ClassThatShouldCompile
@end
@interface ClassThatShouldCompile (Category)
- (id) init;
@end
@implementation ClassThatShouldCompile (Category)
- (id) init
{
[super init];
dictionary = [NSDictionary dictionary]; //This causes the problem.
return self;
}
@end
On Saturday, Sep 14, 2002, at 20:08 America/New_York, bill fancher
wrote:
>
>
On Saturday, September 14, 2002, at 04:34 PM, email@hidden
>
wrote:
>
>
> GCC 3.1 does not compile code as it should (at least from what I have
>
> seen).
>
>
>
> This error is produced
>
>
>
> cannot convert `_objc_class*' to `objc_object*' in argument passing
>
>
I don't see that error, though I get a different one with the code as
>
posted. Adding the import as indicated makes it compile without error
>
here. There must be something in your code (or on the command line)
>
that you didn't post to produce the above error. I'd be interested to
>
know what it is. How are you compiling? I just did
>
>
gcc3 -c test.m
>
>
--bill
>
>
>
>
> For this code:
>
>
#import <Cocoa/Cocoa.h>
>
>
>
> @interface ClassThatShouldCompile: NSObject
>
> {
>
> id dictionary;
>
> }
>
> - (id) init;
>
> @end
>
>
>
> @implementation ClassThatShouldCompile: NSObject
>
> - (id) init
>
> {
>
> [super init];
>
>
>
> dictionary = [NSDictionary dictionary]; //This causes the problem.
>
>
>
> return self;
>
> }
>
> @end
>
>
>
> Whenever the instance variable is changed to a different name, the
>
> code
>
> will compile. Also, this only seems to happen with NSDictionary
>
> objects.
>
> _______________________________________________
>
> 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.
_______________________________________________
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.