• 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: UInt32 and ==
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UInt32 and ==


  • Subject: Re: UInt32 and ==
  • From: rsharp <email@hidden>
  • Date: Tue, 9 Apr 2002 10:54:59 -0500 (CDT)

On Tue, 9 Apr 2002, Jaeho Chang wrote:

> This does not return right results:
>
> - (Boolean) isReadable
> {
> return (auParamInfo.flags & kAudioUnitParameterFlag_IsReadable);
> }
>
> but this does:
>
> - (Boolean) isReadable
> {
> return (((UInt32) auParamInfo.flags &
> kAudioUnitParameterFlag_IsReadable) == ((UInt32)
> kAudioUnitParameterFlag_IsReadable));
> }

As others have pointed out, the Boolean is an 8-bit container and not
suitable to hold the result. Whenever I assign values to a boolean type,
I use boolean expresions. In the case of your method, I would do:

- (Boolean) isReadable
{
return( ( auParamInfo.flags &
kAudioUnitParameterFlag_IsReadable ) != 0 );
}


Rick Sharp
Instant Interactive(tm)
_______________________________________________
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.

References: 
 >UInt32 and == (From: Jaeho Chang <email@hidden>)

  • Prev by Date: Re: ObjC and C++
  • Next by Date: Re: Enumerator and
  • Previous by thread: Re: UInt32 and ==
  • Next by thread: Re: UInt32 and ==
  • Index(es):
    • Date
    • Thread