Re: Enum advice please
Re: Enum advice please
- Subject: Re: Enum advice please
- From: Quincey Morris <email@hidden>
- Date: Tue, 6 Jan 2009 11:59:28 -0800
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 form is all about and whether it matters?)
Start with this pair of declarations. This creates two types,
`DCDBTypes` and `enum _DCDBTypes`: ...
I'm sure someone will jump in and correct me if I'm wrong about this,
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' was the only way to refer to an enum type you'd already defined.
["Later" in this context would be somewhere in the mid-1970s.] Or
perhaps it was just that some C compilers didn't implement 'typedef'
in olden days.
-- The use of typedefs for enums and structs became popular in C after
C++ became popular, because of the convenient 'enum XXX {...}'/'struct
XXX {...}' declaration form in C++ that was more like a typedef than
the apparently identically C syntax.
But maybe I misremember.
_______________________________________________
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