<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx</link><description>It wasn't allowed at one point.</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8337782</link><pubDate>Wed, 26 Mar 2008 17:06:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8337782</guid><dc:creator>Coleman</dc:creator><description>&lt;p&gt;Raymond,&lt;/p&gt;
&lt;p&gt;I always thought this had more to do with name mangling in C++ than C namespaces. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for teaching me something new!&lt;/p&gt;
</description></item><item><title>Chicken and the egg</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8337797</link><pubDate>Wed, 26 Mar 2008 17:14:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8337797</guid><dc:creator>Nathan_works</dc:creator><description>&lt;p&gt;This may sound like a dumb question, and the answer probably exists on the web, though I don't know the right way to phrase it as such..&lt;/p&gt;
&lt;p&gt;Which came first, windows or MSVC (or whatever the first microsoft compiler was that contained all the windows libraries and headers) ?&lt;/p&gt;
&lt;p&gt;I'm wondering if MS had a C compiler on hand to develop windows, or if an alternate compiler was used to develop and compile windows, and later MS developed their own compiler.&lt;/p&gt;
&lt;p&gt;I recall that win95 and MSVC 6 were released in roughly the same time frame (as in, I had a &amp;quot;wow, neat, a windows 95 box!&amp;quot; and MSVC 6 in the same first job... )&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8337836</link><pubDate>Wed, 26 Mar 2008 17:42:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8337836</guid><dc:creator>rlipscombe</dc:creator><description>&lt;p&gt;@Nathan_works: In the past, Microsoft didn't have a compiler that was hosted on Windows. Quick C for Windows and Visual C++ 1.0 were the first.&lt;/p&gt;
&lt;p&gt;Before that, you could use Microsoft C 6.0 to target DOS, Windows or OS/2, if I recall correctly.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8337854</link><pubDate>Wed, 26 Mar 2008 17:53:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8337854</guid><dc:creator>Luciano</dc:creator><description>&lt;p&gt;If i remember correctly (it was many years ago) the first C compiler from microsoft was produced by Lattice...&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8337856</link><pubDate>Wed, 26 Mar 2008 17:56:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8337856</guid><dc:creator>Dave</dc:creator><description>&lt;p&gt;&amp;lt;blockquote&amp;gt;Next time, why you also don't see the pattern typedef struct { ... } XYZ very much either.&amp;lt;/blockquote&amp;gt;&lt;/p&gt;
&lt;p&gt;I’m guessing this has to do with compiler error messages.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8337861</link><pubDate>Wed, 26 Mar 2008 18:05:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8337861</guid><dc:creator>The Barefoot Bum</dc:creator><description>&lt;p&gt;&amp;lt;i&amp;gt;Next time, why you also don't see the pattern typedef struct { ... } XYZ very much either.&amp;lt;/i&amp;gt;&lt;/p&gt;
&lt;p&gt;That seems trivial: you can't then have pointers to the same type of struct within the struct.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8337884</link><pubDate>Wed, 26 Mar 2008 18:22:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8337884</guid><dc:creator>ScottD</dc:creator><description>&lt;p&gt;&amp;quot;Next time, why you also don't see the pattern typedef struct { ... } XYZ very much either.&amp;quot;&lt;/p&gt;
&lt;p&gt;My guess is because you can't forward-declare a struct which has been defined that way. IIRC, it's technically a typedef to an unnamed struct.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8337930</link><pubDate>Wed, 26 Mar 2008 18:56:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8337930</guid><dc:creator>James Curran</dc:creator><description>&lt;p&gt;Next time, why you also don't see the pattern typedef struct { ... } XYZ very much either.&amp;quot;&lt;/p&gt;
&lt;p&gt;Mostly, because I don't believe anonomous struct have ever been legal C syntax (like a widely implemented compiler extension)&lt;/p&gt;
&lt;p&gt;The more basic question is &amp;quot;why do we need the pattern typedef struct XYX { ... } XYZ; at all&amp;quot; (Answer, so we can refer to &amp;quot;struct XYZ&amp;quot; as just &amp;quot;XYZ&amp;quot; is a C program --- The designers of C++ wisely put that ability right into the language without needing the typedef&amp;quot; &lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8337939</link><pubDate>Wed, 26 Mar 2008 19:07:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8337939</guid><dc:creator>dave</dc:creator><description>&lt;p&gt;&amp;quot;Mostly, because I don't believe anonomous struct have ever been legal C syntax (like a widely implemented compiler extension)&amp;quot;&lt;/p&gt;
&lt;p&gt;Anonymous struct types (structs without a tag naming them: `struct {int a, double b} foo={42,3.14};') have been legal since at least 1989 when ANSI standardized the language; I don't have a K&amp;amp;R1 handy to check, but I suspect it goes even farther back than that.&lt;/p&gt;
&lt;p&gt;You may be thinking of anonymous struct members of another struct: 'struct foo { struct {int a; double b;}; char *c;};'. &amp;nbsp;The common extension is to allow access to the members of the anonymous inner struct as 'x.a' (instead of x.inner.a), but the construct isn't legal C.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8337949</link><pubDate>Wed, 26 Mar 2008 19:14:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8337949</guid><dc:creator>pingpong</dc:creator><description>&lt;p&gt;@Nathan_works:&lt;/p&gt;
&lt;p&gt;The compiler released around Win95 timeframe was Microsoft Visual C++ 4.0. It was followed by versions 4.1, 4.2, 5.0 and finally 6.0 in 1998. &lt;/p&gt;
&lt;p&gt;There was no MSVC++ 3.0 AFAIR.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8337970</link><pubDate>Wed, 26 Mar 2008 19:32:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8337970</guid><dc:creator>Jay Bazuzi</dc:creator><description>&lt;P&gt;One of the annoyances with this use of typedefs is that VC++ debugger doesn't know whether to use a type's real name ("tagXYZ") or the typedef'd name ("XYZ"). &amp;nbsp;Since a type can be typedef'd to multiple names, it makes sense for it to pick the canonical name, but as a user, that's not what you usually want to see.&lt;/P&gt;
&lt;P&gt;So, why bother typdef'ing at all? &amp;nbsp;Why not just name the struct XYZ?&lt;/P&gt;
&lt;DIV class=post&gt;[&lt;I&gt;Most people would have quickly tired of typing "struct" all the time. After about the tenth time of typing &lt;CODE&gt;struct DRAWITEMSTRUCT *pdis = (struct DRAWITEMSTRUCT)lParam;&lt;/CODE&gt; you're going to say "Why can't we create a typedef for this structure?" -Raymond&lt;/I&gt;]&lt;/DIV&gt;</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8337978</link><pubDate>Wed, 26 Mar 2008 19:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8337978</guid><dc:creator>VisualC++ x.0</dc:creator><description>&lt;p&gt;&amp;gt;&amp;gt; The compiler released around Win95 timeframe was Microsoft Visual C++ 4.0. &lt;/p&gt;
&lt;p&gt;IIRC, Win95 was published at the same time of Visual C++ 2.0 - the first true 32bit version after the hybrid 1.5. 4.0 came shortly after.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8338006</link><pubDate>Wed, 26 Mar 2008 20:01:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8338006</guid><dc:creator>pingpong</dc:creator><description>&lt;p&gt;According to &lt;a rel="nofollow" target="_new" href="http://www.emsps.com/oldtools/mscppv.htm"&gt;http://www.emsps.com/oldtools/mscppv.htm&lt;/a&gt;, the MSVC 2.0 folders are dated 9/20/94 2:55am - that's almost a year before Win95 release.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8338073</link><pubDate>Wed, 26 Mar 2008 20:48:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8338073</guid><dc:creator>Nathan_works</dc:creator><description>&lt;p&gt;Thanks for the correction on which version of MSVC was released at/around win95 time -- I certainly don't have the install media around to check ;)&lt;/p&gt;
&lt;p&gt;It was 32bit, as the guys before me had just ported it over. I was too green to deal with thunks and other 16 bit issues ... &lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8338363</link><pubDate>Wed, 26 Mar 2008 23:20:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8338363</guid><dc:creator>nikita</dc:creator><description>&lt;p&gt;Struct and union field names used to live in the same global name-space too, and this is where tradition to prepend a unique prefix to struct fields is from. As a byproduct, fields weren't bound to any particular struct type:&lt;/p&gt;
&lt;p&gt;&amp;lt;pre&amp;gt;&lt;/p&gt;
&lt;p&gt;	register *rp;&lt;/p&gt;
&lt;p&gt;	rp = p;&lt;/p&gt;
&lt;p&gt;	if(rp-&amp;gt;i_count == 1) {&lt;/p&gt;
&lt;p&gt;&amp;lt;/pre&amp;gt;&lt;/p&gt;
&lt;p&gt;(v6root/usr/sys/ken/iget.c:iput())&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8338387</link><pubDate>Wed, 26 Mar 2008 23:54:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8338387</guid><dc:creator>ERock</dc:creator><description>&lt;p&gt;This is the first time on Raymond's blog I've read a technical post and have known the answer before I read it.&lt;/p&gt;
&lt;p&gt;I feel so smart.&lt;/p&gt;
&lt;p&gt;Day after tomorrow, though, I will stop knowing the answers and will feel dumb again.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8338468</link><pubDate>Thu, 27 Mar 2008 01:41:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8338468</guid><dc:creator>Ulric</dc:creator><description>&lt;p&gt;&amp;gt;so this workaround is no longer necessary, but &lt;/p&gt;
&lt;p&gt;&amp;gt;it doesn't hurt either. &lt;/p&gt;
&lt;p&gt;It's an annoyance, actually, because in C++ you can't derive a class from the the typedef you're used to see.&lt;/p&gt;
&lt;p&gt;In other words, you have to derive a c++ class from 'tagPOINT' instead of from &amp;quot;POINT&amp;quot;.&lt;/p&gt;
&lt;p&gt;I absolutely hate the 'tag' stuff in Windows header, because programmers have copied it into their code in many companies I've been at, without knowing why. &amp;nbsp;Just like the &amp;quot;LP&amp;quot; typedefs for pointers, or capital VOID.&lt;/p&gt;
&lt;p&gt;The reason why there are typedef at all was that in &amp;quot;C&amp;quot; we had to write &amp;quot;struct POINT pt;&amp;quot; &amp;nbsp;when defining a variable. &amp;nbsp;The typedef saves us from having to type the word 'struct'. &amp;nbsp;In C++, this isn't necessary, and would be totally transparent for us if it wasn't for that 'tag' prefix, which forces us to be aware that there is a type and a typedef.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8338534</link><pubDate>Thu, 27 Mar 2008 03:04:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8338534</guid><dc:creator>steveg</dc:creator><description>&lt;p&gt;Here's a gem of an article about running Windows 1.0 under Virtual PC by Charles Petzold, which might make some oldies smile.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.charlespetzold.com/etc/Windows1/index.html"&gt;http://www.charlespetzold.com/etc/Windows1/index.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I was looking around for a circa Win2.0 Windows.h file to look at structs there... stupid internet, it's like the world didn't exist before 2000.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8338755</link><pubDate>Thu, 27 Mar 2008 05:05:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8338755</guid><dc:creator>IgorD</dc:creator><description>&lt;p&gt;Some compilers alow me to do this:&lt;/p&gt;
&lt;p&gt;typedef struct _a &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;int (*some_func_ptr)(struct _b *);&lt;/p&gt;
&lt;p&gt;} AType;&lt;/p&gt;
&lt;p&gt;typedef struct _b &amp;nbsp;{&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;p&gt;} BType;&lt;/p&gt;
&lt;p&gt;other compilers require this declaration up front before everything else:&lt;/p&gt;
&lt;p&gt;struct _b;&lt;/p&gt;
&lt;p&gt;typedef struct _a &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;int (*some_func_ptr)(struct _b *);&lt;/p&gt;
&lt;p&gt;} AType;&lt;/p&gt;
&lt;p&gt;typedef struct _b &amp;nbsp;{&lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;p&gt;} BType;&lt;/p&gt;
&lt;p&gt;I have no idea what is &amp;quot;more&amp;quot; legal.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8338974</link><pubDate>Thu, 27 Mar 2008 07:44:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8338974</guid><dc:creator>Gabe</dc:creator><description>&lt;p&gt;The Win1.0 SDK came with Microsoft C 3.0, which predates Microsoft VisualC by many years.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8339638</link><pubDate>Thu, 27 Mar 2008 16:27:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8339638</guid><dc:creator>SuperKoko</dc:creator><description>&lt;p&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;Next time, why you also don't see the pattern typedef struct { ... } XYZ very much either.&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;/p&gt;
&lt;p&gt;Short answer: Anonymous structures don't benefit from good error/warning/debug information.&lt;/p&gt;
&lt;p&gt;Side note:&lt;/p&gt;
&lt;p&gt;I remember that Borland C supports something like typedef struct XYZ { ... }; as a special syntax for typedef struct XYZ { ... } XYZ;&lt;/p&gt;
</description></item><item><title>You got a detail wrong.  e: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8340018</link><pubDate>Thu, 27 Mar 2008 20:04:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8340018</guid><dc:creator>Hendrik Boom</dc:creator><description>&lt;p&gt;C had one namespace for struct and union tags, but typedefs were in the same namespace as variables. &amp;nbsp;C did not automatically define a typedef name when you defined a struct. &amp;nbsp;It was C++ that introduced the implicit definition of a typedef name.&lt;/p&gt;
&lt;p&gt;So in C people would write&lt;/p&gt;
&lt;p&gt; &amp;nbsp;typedef struct foo { ... } foo;&lt;/p&gt;
&lt;p&gt; and then they sould refer to the type without mentioning struct.&lt;/p&gt;
&lt;p&gt;But when they tried compiling this in C++, the mention of &amp;quot;struct foo&amp;quot; would define the typedef name 'foo', and when the compiler got around to the 'foo' after then '}', it would complain that 'foo' had already been defined.&lt;/p&gt;
&lt;p&gt;So to use anything like this in C++ you had to change the structure tag.&lt;/p&gt;
&lt;p&gt;I speak from memory - I was a C user in the 70's, and a C++ implementer in the early nineties. &amp;nbsp;C++ may hae chenged then, of course. &amp;nbsp;I haven't been tracking it since then.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8340884</link><pubDate>Fri, 28 Mar 2008 06:28:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8340884</guid><dc:creator>Ian Johns</dc:creator><description>&lt;p&gt;I really should have added this here :&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.embedded.com/columns/programmingpointers/9900748"&gt;http://www.embedded.com/columns/programmingpointers/9900748&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;instead of here :&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/oldnewthing/archive/2008/03/27/8338530.aspx#8340834"&gt;http://blogs.msdn.com/oldnewthing/archive/2008/03/27/8338530.aspx#8340834&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8340953</link><pubDate>Fri, 28 Mar 2008 06:58:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8340953</guid><dc:creator>Yuhong Bao</dc:creator><description>&lt;p&gt;I think the Windows 1.0 SDK came around the time of MS C 4.0, and the Windows 2.0 SDK came around the time of MS C 5.0. Visual C++ 2.0 was released around the time of NT 3.5 (I wonder how many people believed Win95 was the first version of Windows to run Win32 apps natively). Visual C++ 4.0 was released around the release of Win95. Visual C++ 4.2 was released around the release of NT 4.0 and contained the beta of several SDKs, including the ActiveX SDK. 4.2c was released to patch them up to released versions. Visual C++ 6.0 was released around the release of Win98, but still contained the NT 4.0 headers and libraries.&lt;/p&gt;
</description></item><item><title>re: Why are structure names different from their typedef names?</title><link>http://blogs.msdn.com/oldnewthing/archive/2008/03/26/8336829.aspx#8348371</link><pubDate>Tue, 01 Apr 2008 19:23:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8348371</guid><dc:creator>Alexandre Grigoriev</dc:creator><description>&lt;p&gt;IgorD:&lt;/p&gt;
&lt;p&gt;A scope for a structure/class name implicitly declared in the function declaration argument list is limited to the function declaration. It's not propagated up to the enclosing scope. &lt;/p&gt;
&lt;p&gt;void a(class b *c); // not in the global scope&lt;/p&gt;
&lt;p&gt;class b;&lt;/p&gt;
&lt;p&gt;void a(class b *c); // same as in the global scope&lt;/p&gt;
&lt;p&gt;On the other hand, a scope for a structure/class name implicitly declared in a member declaration is propagated to the enclosing scope.&lt;/p&gt;
&lt;p&gt;class d&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;class a *b;&lt;/p&gt;
&lt;p&gt;};&lt;/p&gt;
&lt;p&gt;Here 'class a' belongs to the global scope, as if it were declared before class d declaration.&lt;/p&gt;
&lt;p&gt;But if you do like this:&lt;/p&gt;
&lt;p&gt;class d&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;class a;&lt;/p&gt;
&lt;p&gt;class a *b;&lt;/p&gt;
&lt;p&gt;};&lt;/p&gt;
&lt;p&gt;Then it's class d::class a.&lt;/p&gt;
</description></item></channel></rss>