By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,260 Members | 1,305 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,260 IT Pros & Developers. It's quick & easy.

structs terminology

P: n/a
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.public.vc.language --
http://tinyurl.com/yqj9m (google groups)
Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Shailesh Humbad wrote:
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.public.vc.language -- http://tinyurl.com/yqj9m
(google groups)


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.
Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.