structs terminology

S

Shailesh Humbad

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)
 
J

joey tribbiani

Shailesh said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,169
Messages
2,570,919
Members
47,458
Latest member
Chris#

Latest Threads

Top