Re: Returning a nil float?
Re: Returning a nil float?
- Subject: Re: Returning a nil float?
- From: Jean-Daniel Dupas <email@hidden>
- Date: Sat, 30 Jan 2010 02:02:49 +0100
Le 30 janv. 2010 à 01:44, Chunk 1978 a écrit :
> i'm almost 100% sure it's not possible to return a nil on basic data
> types, but just incase i'll post the question.
>
> ------------------------------------------------------
> - (float)panForSoundWithName:(NSString *)soundName
> {
> OpenALSound *sound = [soundDictionary objectForKey:soundName];
> if (!sound) return 0.0f;
> return sound.pan;
> }
> ------------------------------------------------------
>
One solution is to change you API and use byref value.
- (BOOL)getPan:(float *)thePan ForSoundWithName:(NSString *)soundName {
NSParameterAssert(thePan);
OpenALSound *sound = [soundDictionary objectForKey:soundName];
if (!sound) return NO;
*thePan = sound.pan;
return YES;
}
-- Jean-Daniel
_______________________________________________
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