• 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: Turning off 'enumeral mismatch' warnings?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Turning off 'enumeral mismatch' warnings?


  • Subject: Re: Turning off 'enumeral mismatch' warnings?
  • From: Adin Hunter Baber <email@hidden>
  • Date: Fri, 12 May 2006 07:28:38 -0500


On 2006 May 11, at 8:23 PM, Steve Sisak wrote:

At 6:15 PM -0700 5/11/06, Chris Espinosa wrote:
On May 11, 2006, at 5:47 PM, James W. Walker wrote:
Matt Gough <<mailto:email@hidden>email@hidden> wrote:
However, anytime I do the 'err = someParam ? noErr : paramErr' portion I get one of the following warnings:

warning: enumeral mismatch in conditional _expression_: '<anonymous enum>' vs '<anonymous enum>'

This is known as <<rdar://problem/2869460>rdar://problem/2869460> anonymous enum clashes in conditionals and there is currently no workaround.

This was driving me nuts too.

A workaround for this specific case is:

  err = someParam ? (OSErr) noErr : paramErr;

By casting either param to an integer type, the other is promoted and the types now match (and you probably wanted OSErr or OSStatus anyway).


OSErr is a typedef for SInt16.
OSStatus is a typedef for SInt32

I know that the error codes go down at least to -32768 (svTempDisable).

Are there error code below that? If there are, I could see some odd bugs happening if someone only uses OSErr to do the casting.
For example stepping through the debugger with this code:
OSStatus error = -32773;
OSStatus error2 = (OSErr)error;
will end up giving error2 a value of 32763.


Adin Hunter Baber
email@hidden



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Turning off 'enumeral mismatch' warnings? (From: Matt Gough <email@hidden>)
 >Re: Turning off 'enumeral mismatch' warnings? (From: "James W. Walker" <email@hidden>)
 >Re: Turning off 'enumeral mismatch' warnings? (From: Chris Espinosa <email@hidden>)
 >Re: Turning off 'enumeral mismatch' warnings? (From: Steve Sisak <email@hidden>)

  • Prev by Date: Re: Miscellaneous XCode Questions
  • Next by Date: How to Index Russian help?
  • Previous by thread: Re: Turning off 'enumeral mismatch' warnings?
  • Next by thread: Run Script dependency
  • Index(es):
    • Date
    • Thread