• 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: Christiaan Hofman <email@hidden>
  • Date: Wed, 10 Nov 2010 22:59:13 +0100

On Nov 10, 2010, at 21:54, Jonathon Kuo wrote:

> Xcode 3.2.4, Cocoa project, .m file.
>
> gcc sees kFlag as an integer in the flag_type assignment, but not when used as a case label?
>
> static const uint32_t kFlag  = '3gI7';
> . . .
>  uint32_t flag_type = kFlag;
> . . .
>  switch (flag_type) {
>    case kFlag:
> *** error: case label does not reduce to an integer constant
>

No. There is no requirement for initial value assignments. However values in a switch statement are required to be constant integer values (that's something very different from integer const variables). the way you usually handle this case is through an enum, sometimes a #define is used.

Christiaan

 _______________________________________________
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: Jonathon Kuo <email@hidden>)

  • Prev by Date: Case label does not reduce to an integer constant
  • Next by Date: Re: Case label does not reduce to an integer constant
  • Previous by thread: Case label does not reduce to an integer constant
  • Next by thread: Re: Case label does not reduce to an integer constant
  • Index(es):
    • Date
    • Thread