Re: Enum advice please

2009-01-07 Thread Quincey Morris
On Jan 7, 2009, at 03:12, Jeremy Pereira wrote: enum was added to C after typedef. When I first started learning C in the mid 80's (from K & R first edition), typedef already existed as a keyword but enum didn't. In fact, I don't think enum became an official part of C until the first ANS

Re: Enum advice please

2009-01-07 Thread Jeremy Pereira
On 6 Jan 2009, at 19:59, Quincey Morris wrote: I'm sure someone will jump in and correct me if I'm wrong about this, Jumping in but (in answer to the implied "why?" in Graham's post) my recollection is that: -- 'typedef' was added to C later in its life, so originally 'enum XXX' w

Re: Enum advice please (resend not sure if it was delivered ?)

2009-01-06 Thread Damien Cooke
Jeremy, Thanks, as it turns out if I put it above the @interface statement in the header file it works like a treat as you would I suspect as it should not be part of the class that I was building. Regards Damien On 06/01/2009, at 8:43 PM, Jeremy Pereira wrote: I pasted your code into a

Re: Enum advice please

2009-01-06 Thread Quincey Morris
On Jan 6, 2009, at 11:19, Greg Parker wrote: On Jan 6, 2009, at 1:53 AM, Graham Cox wrote: 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

Re: Enum advice please

2009-01-06 Thread Greg Parker
On Jan 6, 2009, at 1:53 AM, Graham Cox wrote: On 5 Jan 2009, at 6:14 pm, Damien Cooke wrote: typedef enum _DCDBTypes { DCOItemType = 0, DCOCategoryType = 1, DCORegionType = 2 }DCDBTypes; That said, also try this: typedef enum { DCOItemType = 0, DCOCat

Re: Enum advice please (resend not sure if it was delivered ?)

2009-01-06 Thread Jeremy Pereira
I pasted your code into a simple C program and it compiled no problem. Is it possible that the error is in the previous declaration to the typedef? Bear in mind it might be a problem in a header file. On 5 Jan 2009, at 10:49, Damien Cooke wrote: Hi all, I have the following code: typ

Re: Enum advice please

2009-01-06 Thread Graham Cox
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'

Enum advice please (resend not sure if it was delivered ?)

2009-01-06 Thread Damien Cooke
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

Enum advice please

2009-01-06 Thread Damien Cooke
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