Why is typedef needed with struct and enum?
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