• 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: 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


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

  • Prev by Date: Re: QTMovieLayer and QCCompositionLayer Don't Start
  • Next by Date: RE: Table sort image question
  • Previous by thread: Re: Enum advice please
  • Next by thread: Re: Enum advice please
  • Index(es):
    • Date
    • Thread