purpose of typedef struct etc. ?

Sharky Forums


Results 1 to 6 of 6

Thread: purpose of typedef struct etc. ?

Threaded View

  1. #1
    Tiger Shark Remington's Avatar
    Join Date
    Apr 2001
    Location
    Calgary, Alberta, Canada
    Posts
    702

    purpose of typedef struct etc. ?

    I see this kind of thing a lot:

    typedef struct
    {
    //
    } name;

    or this

    typedef enum
    {
    //
    } name;

    My question is why do people do this? Does this notation have some kind of special function? Isn't it simpler to write:

    struct name
    {
    //
    };

    and

    enum name
    {
    //
    };

    ????
    Might it have something to do with C vs. C++ if so why do I see this type of notation in purely c++ files which have c++ only code all over the place?
    I have never come across an instance where I would even concieve of using the previous method so if somone would be so kind and explain what the point of that is I would be grateful.
    Last edited by Remington; 09-01-2003 at 11:59 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •