• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Returning a nil float?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Returning a nil float? (From: Chunk 1978 <email@hidden>)

  • Prev by Date: Re: Returning a nil float?
  • Next by Date: Re: Returning a nil float?
  • Previous by thread: Re: Returning a nil float?
  • Next by thread: Re: Returning a nil float?
  • Index(es):
    • Date
    • Thread