• 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: Incorrect warning
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Incorrect warning


  • Subject: Re: Incorrect warning
  • From: Steve Mills <email@hidden>
  • Date: Tue, 16 Nov 2004 09:21:46 -0600

On Nov 16, 2004, at 01:41, Chris Espinosa <email@hidden> wrote:

The compiler absolutely cares about signedness when doing comparisons.
[snip]

You mean there's actually an equality operator that compares 32 bits when the data is signed and another equality operator that compares the *same* 32 bits when the data is unsigned? How completely odd.

Nope, enums are by default ints, which are by definition signed.

I suppose I could turn the enums back into const's, which is how they started life many years ago, but then had to be changed to an enum when we started the cross-platform thang. Oh man.


Since C++ doesn't allow you to declare the type of an enumeration, your
two choices are to a) don't use -Wsign-compare or b) explicitly cast
your enumerals to (DescType) in your comparisons.

Arg. I like it a lot better when it just works in CodeWarrior. I like having the warning on in Xcode for *times when it really matters*, but for comparing 32-bit integer equality it really shouldn't care about signs.


Steve Mills
Drummer, Mac geek
http://sjmills5.home.mchsi.com/

_______________________________________________
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


  • Follow-Ups:
    • Re: Incorrect warning
      • From: Bryan Pietrzak <email@hidden>
  • Prev by Date: XCode died?!
  • Next by Date: Re: XCode died?!
  • Previous by thread: Re: Incorrect warning
  • Next by thread: Re: Incorrect warning
  • Index(es):
    • Date
    • Thread