• 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: Enum advice please
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Enum advice please


  • Subject: Re: Enum advice please
  • From: Graham Cox <email@hidden>
  • Date: Tue, 6 Jan 2009 20:53:04 +1100


On 5 Jan 2009, at 6:14 pm, Damien Cooke wrote:


Hi all, I have the following code:


typedef enum _DCDBTypes { DCOItemType = 0, DCOCategoryType = 1, DCORegionType = 2 }DCDBTypes;

It gives me this error message.

error: expected specifier-qualifier-list before 'typedef'

If I try to use it like this

- (void)setItemType:(DCDBTypes) newType;

I get this error message

error: expected ')' before 'DCDBTypes'

I have stared at this piece of code for so long, I know it is something stupid I have assumed or done, please glance over it and point me in the right direction if possible.


Maybe the error is really on the line above 'typedef'? Compilers are pretty dumb and keep on parsing until they get *really* confused. The real error maybe above this.

That said, also try this:

typedef enum
{
	DCOItemType = 0,
	DCOCategoryType = 1,
	DCORegionType = 2
}
DCDBTypes;

I never add in those _blahblah things after enum, I've never understood what they're for. I always typedef enums like this and they always work just fine. (Maybe someone could explain what this other form is all about and whether it matters?)

hth,

Graham


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Enum advice please
      • From: Greg Parker <email@hidden>
References: 
 >Enum advice please (From: Damien Cooke <email@hidden>)

  • Prev by Date: Re: Stumped on memory problem :(
  • Next by Date: Re: Overlay controls a la iTunes and QuickTime
  • Previous by thread: Enum advice please
  • Next by thread: Re: Enum advice please
  • Index(es):
    • Date
    • Thread