structs terminology

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Shailesh Humbad

    structs terminology

    Is there official terminology for these four different ways to declare
    and/or define a struct?

    struct tagname { ... } identifier;
    struct { ... } identifier;
    struct tagname { ... };
    struct { ... };

    Terms that have been thrown around are unnamed struct, anonymous
    struct, and unnamed anonymous struct. I know that the last example
    above is not legal C++, but it is supported by MSVC and gcc. I didn't
    get a complete answer in microsoft.publi c.vc.language --
    http://tinyurl.com/yqj9m (google groups)
  • joey tribbiani

    #2
    Re: structs terminology

    Shailesh Humbad wrote:[color=blue]
    > Is there official terminology for these four different ways to declare
    > and/or define a struct?
    >
    > struct tagname { ... } identifier;
    > struct { ... } identifier;
    > struct tagname { ... };
    > struct { ... };
    >
    > Terms that have been thrown around are unnamed struct, anonymous struct,
    > and unnamed anonymous struct. I know that the last example above is not
    > legal C++, but it is supported by MSVC and gcc. I didn't get a complete
    > answer in microsoft.publi c.vc.language -- http://tinyurl.com/yqj9m
    > (google groups)[/color]

    If the tagname ( sturcture-name ) is omitted, the variable is still to
    be defined, but no data type is created. The data type for this variable
    is an anonymous structure.

    If the variable-name part is omitted, a structure type would be defined
    you can use later to declare variables.

    If both the variable-name and the sturcture-name are omitted, correct
    but useless code is created.

    Comment

    Working...