• 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
Why is typedef needed with struct and enum?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why is typedef needed with struct and enum?


  • Subject: Why is typedef needed with struct and enum?
  • From: Jerry Krinock <email@hidden>
  • Date: Fri, 08 Jul 2005 19:24:51 -0700

In CodeWarrior, I've always done the following, which according to my C/C++
textbook is perfectly good syntax:

struct MyStruct
{
    int n1 ;
    int n2 ;
}  ;

enum NodeType
{
    kRoot = 1,
    kFolder = 2
} ;

But after porting my code to Xcode, getting errors and then looking at
others' Xcode code, I learned that I now have to do this:

typedef struct MyStruct_type
{
    int n1 ;
    int n2 ;
} MyStruct ;

typedef enum
{
    kRoot = 1,
    kFolder = 2
} NodeType ;

Which is OK, according to my book, but why does Xcode make me do all this
extra typing?  I'm afraid that I'm missing an important point.


 _______________________________________________
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

  • Follow-Ups:
    • Re: Why is typedef needed with struct and enum?
      • From: Charlton Wilbur <email@hidden>
    • Re: Why is typedef needed with struct and enum?
      • From: "Justin C. Walker" <email@hidden>
  • Prev by Date: Searching List Archives
  • Next by Date: Re: Why is typedef needed with struct and enum?
  • Previous by thread: Re: Searching List Archives
  • Next by thread: Re: Why is typedef needed with struct and enum?
  • Index(es):
    • Date
    • Thread