public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* gcc question about the embedded type definitions
@ 2004-12-03  6:51 Wei ZHANG
  2004-12-03  9:20 ` Nathan Sidwell
  0 siblings, 1 reply; 4+ messages in thread
From: Wei ZHANG @ 2004-12-03  6:51 UTC (permalink / raw)
  To: GCC Help

Hi,

I have a question on embedded type definitions.

If in a structure definition, another type is defined. e.g.

typedef struct S1 {
struct S2 {
int a;
}
} S1;

is the data type S2 visible outside S1? Originally i think it is not 
visible outside.

But in gcc, I can declare a varible of type struct S2, and operate on 
it. e.g.:

S2 b;
b.a = 100;
printf("result = %d\n", b.a);

That implies the name of the structure type S2 must be unique in the C 
file. Am I right? Can anyone elaborate on this? Thanks!

Best Regards,
Zhang Wei

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-12-03 11:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-03  6:51 gcc question about the embedded type definitions Wei ZHANG
2004-12-03  9:20 ` Nathan Sidwell
2004-12-03 11:29   ` Serge Fukanchik
2004-12-03 11:38     ` Nathan Sidwell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).