• 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: Case label does not reduce to an integer constant . . .
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Case label does not reduce to an integer constant . . .


  • Subject: Re: Case label does not reduce to an integer constant . . .
  • From: "Michael A. Crawford" <email@hidden>
  • Date: Mon, 08 Feb 2010 11:49:19 -0500

So this is a difference between C and C++, then.  Ok, I can live with that.  I'll switch to enums.

-Michael

On Feb 8, 2010, at 11:46 AM, Jens Alfke wrote:


On Feb 8, 2010, at 7:59 AM, Michael A. Crawford wrote:

static NSUInteger const kGPSSettingsRowIndex            = 0;

In C, integer constants like this are a little bit broken. They get treated as full-fledged integer variables whose values can't be changed, rather than compile-time constants. In most cases this seems to work out OK, except that the linker allocates spaces for the variable, but it sounds like you've hit a case where the optimizer doesn't constant-fold the _expression_ and decides it isn't a valid case label.

Using a #define or an enum is more reliable in C.

—Jens

 _______________________________________________
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: 
 >Case label does not reduce to an integer constant . . . (From: "Michael A. Crawford" <email@hidden>)
 >Re: Case label does not reduce to an integer constant . . . (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: Case label does not reduce to an integer constant . . .
  • Next by Date: Re: Programs' following -F not found
  • Previous by thread: Re: Case label does not reduce to an integer constant . . .
  • Next by thread: can c++ tool call a cocoa framework?
  • Index(es):
    • Date
    • Thread