Warning with the overwrite release method


#1

Everything so far works perfect, I was surprised the code was not generating random combinations every time I was recompiling it, thanks to this forum I saw other users having similar problems. But I have this warning in my release method and it is just bothering me:

[code]-(id)retain{
return self;
}
-(NSUInteger)retainCount{
return NSUIntegerMax;
}
-(void)release{

}[/code]

[color=#FFBF40]-(void)[/color]release{
}

For some reason I am getting a warning if I try to over write my release method:
“Conflicting distributed object modifiers on return type in implementation of release”

This is really not throwing me off, but it is just bothering me why I am getting the warning if I am just trying to overwrite a release method.
Beside later on, I dont want anyone to accidentally release it either!


#2

I’ve been getting the same problem so I thought I’d have a look for solutions swell. I have found one solution on stackoverflow (stackoverflow.com/questions/7379 … es-warning).

The short version is to add the word ‘oneway’ before the void.

-(oneway void)release{
//Do nothing
}

This is apparently because NSObject uses it in it’s declaration and therefore you need to when you’re overriding it. I’m still a little hazy on what a ‘oneway void’ is as opposed to a ‘void’ but it’s gotten rid of the error, which will hopefully satisfy you until someone who knows what they’re talking about can chip in explaining it to both of us :smiley:


#3

That satisfies me :slight_smile: interesting to learn a new one way void !
Thanks for posting the solution.

cheers


#4

Oneway is a legacy term from something called Distributed Objects.

Distributed Objects was a system where you could have objects on a remote computer. You could send a message to that object and it would actually send the message over the wire and return the result.

If I recall correctly, declaring a method as “oneway” would say “don’t wait for the result, just send the message and keep going.”