<?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>I Love that New Syntax Smell : post responses</title><link>http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx</link><description>Tags: post responses</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Properties Part 2 - defining default properties</title><link>http://blogs.msdn.com/arich/archive/2005/08/10/211482.aspx</link><pubDate>Thu, 11 Aug 2005 03:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:211482</guid><dc:creator>arich</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/arich/comments/211482.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=211482</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;Disclaimer.&lt;/STRONG&gt;&amp;nbsp; This is an ancient post.&amp;nbsp; By the looks of it, I originally intended to write this almost a year ago, as a follow up to my &lt;a href="http://blogs.msdn.com/arich/archive/2004/07/27/199213.aspx"&gt;scalar properties writeup&lt;/A&gt;.&amp;nbsp; That was back when I was testing properties (and more exactly, default properties) and some of the design was still in flux.&amp;nbsp; Now it's pretty nailed down (there's very little time to change it for Whidbey, anyhow), and it dawned on me that&amp;nbsp;I hadn't posted this material.&amp;nbsp; So, I'll do it now, with a bit of fixup.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;The Way C# Does It.&lt;/STRONG&gt;&amp;nbsp; Reader Rob Walker asked over a year ago:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;Why do I have to specify the type of the property 3 times in the definition? It makes this new syntax more verbose than the old.&amp;nbsp; Why not just adopt the C# style?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;Let me start by mentioning that I'm not a member of the design team.&amp;nbsp; I've been included on various discussions that take place regarding the syntax, but I haven't been the one making the decisions.&amp;nbsp; I can only make guesses as to their reasonings (or ask them).&amp;nbsp; Either way, the reasoning is my own.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;I believe there are two reasons why we wouldn't adopt the C# style.&amp;nbsp; First, there's an existing property syntax that users are familiar with.&amp;nbsp; The changes between the two syntaxes are somewhat minor.&amp;nbsp; Second, the C# property syntax doesn't fit well with C++ paradigms.&amp;nbsp; Though simple, I imagine the syntax could wreak havok on parsers, and could introduce a number of ambiguities in the language.&amp;nbsp; One of the goals of adding CLI to C++ was to not break existing paradigms, where possible.&amp;nbsp; Finally, the designers wanted to do what felt natural to C++ users.&amp;nbsp; C++ users aren't familiar with functions that have no parameter lists, that's unusual.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;Speaking of how C# does it, here it is:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P dir=ltr&gt;&lt;FONT face="Courier New" size=2&gt;public class ArrayWrap {&lt;BR&gt;&amp;nbsp; public ArrayWrap(){ arr = new int[10]; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp; public int this[int idx] {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; get{&amp;nbsp; return arr[idx]; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set{&amp;nbsp; arr[idx] = value; }&lt;BR&gt;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp; private int[] arr;&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;And here's code to produce the equivalent class in C++:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P dir=ltr&gt;&lt;FONT face="Courier New" size=2&gt;public ref class ArrayWrap {&lt;BR&gt;public:&amp;nbsp; &lt;BR&gt;&amp;nbsp; ArrayWrap(){ arr = gcnew array&amp;lt;int&amp;gt;(10); }&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face="Courier New" size=2&gt;&amp;nbsp; property int default[int] {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int get(int idx){&amp;nbsp; return arr[idx]; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void set(int idx, int value){ arr[idx] = value; }&lt;BR&gt;&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face="Courier New" size=2&gt;private:&lt;BR&gt;&amp;nbsp; array&amp;lt;int&amp;gt;^ arr;&lt;BR&gt;};&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;We stole the default keyword&lt;/STRONG&gt; and co-opted it for use in indexed properties.&amp;nbsp; Note that you still make use of the property keyword.&amp;nbsp; When this comes out in IL, it looks almost exactly like the C# indexer - with the default property being named "Item" and the getters and setters also thusly named.&amp;nbsp; You can change the name of the default property by using the attribute System::Reflection::DefaultMember on the class.&amp;nbsp; The compiler sees this attribute and interprets it to mean that the default member you created in the class should be named whatever you pass in the attribute ctor.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;A weird IL trick &lt;/STRONG&gt;leads to another way you can generate a class with a default indexer using that attribute.&amp;nbsp; In IL, a property is a default indexer if it meets two requirements: 1) it is an indexed property, and 2) its name matches the name in the DefaultMember attribute.&amp;nbsp; So, you can actually generate a default member in C++ using code like this:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P dir=ltr&gt;&lt;FONT face="Courier New" size=2&gt;[System::Reflection::DefaultMember("Foo")]&lt;BR&gt;public ref class ArrayWrap {&lt;BR&gt;public:&amp;nbsp;&amp;nbsp;&lt;BR&gt;&amp;nbsp; property int Foo [int] { ...&amp;nbsp; }&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;However, I do not recommend this approach, except as a possible way to workaround bugs, or to obfuscate for fun, as the C++ compiler will not recognize Foo as a default property when &lt;EM&gt;compiling&lt;/EM&gt;, only when &lt;EM&gt;importing&lt;/EM&gt;.&amp;nbsp; Also, although it is legal in IL, I do not recommend using this trick to make default scalar properties.&amp;nbsp; That's just unpleasant.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;In a future posting,&lt;/STRONG&gt; I'll go over the various ways you can access properties, which may come in handy as workarounds.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=211482" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/articles/default.aspx">articles</category><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item><item><title>Another good customer bug</title><link>http://blogs.msdn.com/arich/archive/2004/09/13/228898.aspx</link><pubDate>Mon, 13 Sep 2004 17:28:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:228898</guid><dc:creator>arich</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/arich/comments/228898.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=228898</wfw:commentRss><description>&lt;p&gt;&lt;font face="Arial" size="2"&gt;Reader Andy Neilson writes in with another bug:&lt;/font&gt;&lt;/p&gt; &lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt; &lt;p&gt;&lt;font size="2"&gt;The current compiler implementation has some problems. If the variable is a field of this, then the compiler will die. For example:&lt;/font&gt; &lt;br /&gt;&lt;br /&gt;&lt;font face="Courier New" size="2"&gt;class MyClass { &lt;br /&gt;public: &lt;br /&gt;&amp;nbsp; int i; &lt;br /&gt;&lt;br /&gt;&amp;nbsp; void Foo() { &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;array&amp;lt;int&amp;gt;^ x = {1, 2, 3}; &lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; for each (i in x) { &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; if (i == 2) break; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&lt;br /&gt;&amp;nbsp; } &lt;br /&gt;};&lt;/font&gt; &lt;/p&gt;&lt;/blockquote&gt; &lt;p dir="ltr"&gt;&lt;font face="Arial" size="2"&gt;This is also a bug.&amp;nbsp; I'll file it in our bug tracking database.&amp;nbsp; I'm not sure what the design decision will be; it feels like we should disallow the construct you show - but I'm not certain.&amp;nbsp; I found a "sort-of" workaround; you can use a tracking reference to an integer to do it, such as:&lt;/font&gt;&lt;/p&gt; &lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt; &lt;p dir="ltr"&gt;&lt;font face="Courier New" size="2"&gt;&lt;font color="#0000ff"&gt;void&lt;/font&gt; Foo() {&lt;br /&gt;&amp;nbsp; array&amp;lt;&lt;font color="#0000ff"&gt;int&lt;/font&gt;&amp;gt;^ x = {1, 2, 3};&lt;br /&gt;&amp;nbsp; &lt;font color="#0000ff"&gt;int&lt;/font&gt;% a = i;&lt;br /&gt;&amp;nbsp; &lt;font color="#0000ff"&gt;for each&lt;/font&gt; (a in x) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;br /&gt;&amp;nbsp; }&lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p dir="ltr"&gt;&lt;font face="Arial" size="2"&gt;Thanks for the bug report!&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=228898" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item><item><title>I love when customers find bugs!</title><link>http://blogs.msdn.com/arich/archive/2004/09/09/227557.aspx</link><pubDate>Thu, 09 Sep 2004 20:12:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:227557</guid><dc:creator>arich</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/arich/comments/227557.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=227557</wfw:commentRss><description>&lt;div style="DISPLAY: block"&gt;&lt;font face="Arial" size="2"&gt;Reader Rob Walker asks:&lt;/font&gt;&lt;/div&gt; &lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt; &lt;div style="DISPLAY: block"&gt;&lt;font face="Arial" size="2"&gt;Is there a neat way of handling dictionaries?&amp;nbsp; I have a Dictionary&amp;lt;Guid, Object^&amp;gt; and want to iterate over the values. &lt;br /&gt;&lt;br /&gt;Currently I have to use the syntax: &lt;br /&gt;&lt;br /&gt;for each(KeyValuePair&amp;lt;Guid, Object^&amp;gt; v in dict) &lt;br /&gt;{ &lt;br /&gt;&amp;nbsp; v.Value ... &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;I can't find an invocation that would allow &lt;br /&gt;&lt;br /&gt;for each (Object^ v in dict-&amp;gt;Values) &lt;br /&gt;&lt;br /&gt;(This is using the Whidbey beta 1 compiler refresh).&lt;/font&gt; &lt;/div&gt;&lt;/blockquote&gt; &lt;div dir="ltr" style="DISPLAY: block"&gt;&lt;font face="Arial" size="2"&gt;I imagine, Rob, that you're getting what I'm getting from the compiler, which is:&lt;/font&gt;&lt;/div&gt; &lt;div dir="ltr" style="DISPLAY: block"&gt;&lt;font face="Arial" size="2"&gt;&amp;nbsp;&amp;nbsp; &lt;font face="Courier New"&gt;error C3285: for each statement cannot operate on variables of type 'overloaded-function'&lt;/font&gt;&lt;/font&gt;&lt;/div&gt; &lt;div dir="ltr" style="DISPLAY: block"&gt;&lt;font face="Arial" size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/div&gt; &lt;div dir="ltr" style="DISPLAY: block"&gt;&lt;font face="Arial" size="2"&gt;That just doesn't seem right to me.&amp;nbsp; In fact, I made an incredibly simple case, and tried it with a very recent compiler:&lt;/font&gt;&lt;/div&gt; &lt;blockquote dir="ltr" style="MARGIN-RIGHT: 0px"&gt; &lt;div dir="ltr" style="DISPLAY: block"&gt;&lt;font face="Courier New" size="2"&gt;&lt;font color="#0000ff"&gt;using namespace &lt;/font&gt;&lt;font color="#000000"&gt;System;&lt;/font&gt;&lt;/font&gt;&lt;/div&gt; &lt;div dir="ltr" style="DISPLAY: block"&gt;&lt;font face="Courier New" color="#0000ff" size="2"&gt;&lt;/font&gt;&amp;nbsp;&lt;/div&gt; &lt;div dir="ltr" style="DISPLAY: block"&gt;&lt;font face="Courier New" size="2"&gt;&lt;font color="#0000ff"&gt;ref struct&lt;/font&gt; R{&lt;br /&gt;&amp;nbsp;&lt;font color="#0000ff"&gt;property&lt;/font&gt; array&amp;lt;&lt;font color="#0000ff"&gt;int&lt;/font&gt;&amp;gt;^ p;&amp;nbsp;&lt;br /&gt;};&lt;/font&gt;&lt;/div&gt; &lt;div dir="ltr" style="DISPLAY: block"&gt;&lt;font face="Courier New" size="2"&gt;&lt;font color="#0000ff"&gt;int&lt;/font&gt; main(){&lt;br /&gt;&amp;nbsp;R^ r = &lt;font color="#0000ff"&gt;gcnew&lt;/font&gt; R;&lt;br /&gt;&amp;nbsp;for each( &lt;font color="#0000ff"&gt;int&lt;/font&gt; i in r-&amp;gt;p ){}&lt;br /&gt;}&lt;/font&gt;&lt;font face="Arial" size="2"&gt;&lt;/div&gt;&lt;/blockquote&gt; &lt;div dir="ltr" style="DISPLAY: block"&gt;And this also gives me that same error.&amp;nbsp; I talked with the guy responsible for testing for each, and he confirmed my suspicion - that's a bug.&amp;nbsp; Good catch!&amp;nbsp; I've filed it in our bug tracking database, and shot it over to the proper developer.&amp;nbsp; (With a note that this bug came from a customer - which always raises bug priority.)&lt;/div&gt; &lt;div dir="ltr" style="DISPLAY: block"&gt;&amp;nbsp;&lt;/div&gt; &lt;div dir="ltr" style="DISPLAY: block"&gt;In the meantime, there's a pretty simple workaround.&amp;nbsp; You should be able to get around this problem by calling the property accessor method directly.&amp;nbsp; In my case, that'd be &lt;font face="Courier New"&gt;r-&amp;gt;p::get()&lt;/font&gt;, and in your case, it'd be &lt;font face="Courier New"&gt;dict-&amp;gt;Values::get()&lt;/font&gt;.&amp;nbsp; That should allow you to use &lt;font face="Courier New"&gt;for each&lt;/font&gt; on that collection.&lt;/div&gt; &lt;div dir="ltr" style="DISPLAY: block"&gt;&amp;nbsp;&lt;/div&gt; &lt;div dir="ltr" style="DISPLAY: block"&gt;By the way, I'm sort-of touching on bits of the property syntax which I haven't discussed yet in this blog.&amp;nbsp; I'll try to get back to that subject after DF.&lt;/div&gt;&lt;/font&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=227557" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item><item><title>.NET, 7.0, 2003, what's it all mean?</title><link>http://blogs.msdn.com/arich/archive/2004/07/09/178503.aspx</link><pubDate>Fri, 09 Jul 2004 16:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:178503</guid><dc:creator>arich</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/arich/comments/178503.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=178503</wfw:commentRss><description>&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial&gt;A reader asked the question:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial size=2&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;EM&gt;Is .NET, in fact, the SAME THING as Visual Studio 7.0? Could it be possible that a developer with .NET would be able to simply open the project file and recompile without rewriting code?&lt;/EM&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial&gt;.NET itself is a runtime. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Unfortunately, the word ".NET" has started creeping into a lot of our product names, including our latest Server OS, and a few versions of Visual Studio.&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;Visual Studio .NET&lt;/STRONG&gt; is, indeed, version 7.0. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;The latest public offering, &lt;STRONG&gt;Visual Studio .NET 2003&lt;/STRONG&gt; (codename &lt;?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" /&gt;&lt;st1:City w:st="on"&gt;&lt;st1:place w:st="on"&gt;Everett&lt;/st1:place&gt;&lt;/st1:City&gt;), is version 7.1.&amp;nbsp; &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial&gt;The next product we're going to offer, codename Whidbey (and named externally as &lt;STRONG&gt;Visual Studio 2005&lt;/STRONG&gt;), is version 8.0.&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;&lt;o:p&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial&gt;(I have a little more on this subject here: &lt;/FONT&gt;&lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/arich/archive/2003/12/17/44187.aspx"&gt;&lt;FONT face=Arial size=2&gt;http://blogs.msdn.com/arich/archive/2003/12/17/44187.aspx&lt;/FONT&gt;&lt;/A&gt;)&lt;/P&gt;&lt;/o:p&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial&gt;You'd have to talk to marketing as to why we can't use release names that make sense.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Believe me, they make no sense inside the company, either. &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;(At least the next version won't have ".NET" in the product name.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;That was starting to bug me.)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT size=2&gt;&lt;FONT face=Arial&gt;Furthermore, you should be able to open a VS7.0 project file in VS7.1 (.NET 2003).&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Upon opening it, the IDE will ask if you want to convert the project to 7.1.&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;Be warned, however, that this conversion is *not* reversible. &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Arial size=2&gt;As to your question about being able to take 7.0 code into other versions, and compile immediately, the answer is most usually no.&amp;nbsp; Improvements, bug fixes, and conformance all tend to hurt a compiler's backwards compatibility, and occasionally, we find it necessary to &amp;#8220;break&amp;#8220; our upgrading customers in the name of progress.&amp;nbsp; We try to do this as infrequently as possible.&amp;nbsp; For help on converting from 7.0 to 7.1, I suggest you check out the &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/vclrfBreakingChangesInVisualCCompiler.asp"&gt;breaking changes article&lt;/A&gt; on MSDN.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face=Arial size=2&gt;&lt;/FONT&gt;&lt;/o:p&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoPlainText style="MARGIN: 0in 0in 0pt"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=178503" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item><item><title>Pointer to String chars - Everett style</title><link>http://blogs.msdn.com/arich/archive/2003/12/22/45219.aspx</link><pubDate>Mon, 22 Dec 2003 22:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:45219</guid><dc:creator>arich</dc:creator><slash:comments>9</slash:comments><comments>http://blogs.msdn.com/arich/comments/45219.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=45219</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Garrett asked:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;P&gt;&lt;FONT size=2&gt;If the source text is in a CLR String, and we want to pass(even read-only) to unmanaged code, it appears that there is no way to get a pointer to the String's buffer directly. We have to use the marshalling stuff to get it there, which in itself makes a copy.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size=2&gt;Given that one of managed C++ and CLI/C++ 's goals (imnsho) is to facilitate leveraging existing native c++ code, has any thought been given to this?&lt;/FONT&gt; &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;Can I get a native pointer to&amp;nbsp;the data in a&amp;nbsp;CLR String?&lt;/STRONG&gt;&amp;nbsp; The short answer is yes, so long as you don't mind a &lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;wchar_t&lt;/FONT&gt;*&lt;/FONT&gt; - which is native analog of&amp;nbsp;the actual backing store type for a CLR String (the CLR type &lt;FONT face="Courier New"&gt;System::Char&lt;/FONT&gt;). &amp;nbsp; Even in Everett, we supported doing this.&amp;nbsp; You have to use a special function in order to get at it, located in the header file &lt;FONT face="Courier New"&gt;&lt;VCCLR.H&gt;, &lt;/FONT&gt;&lt;FONT face=Arial&gt;which shipped with Everett.&amp;nbsp; This header file includes a function, &lt;FONT face="Courier New"&gt;PtrToStringChars&lt;/FONT&gt;, which takes a &lt;FONT face="Courier New"&gt;String*&lt;/FONT&gt; and returns a &lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;wchar_t __gc&lt;/FONT&gt;*&lt;/FONT&gt;.&amp;nbsp; You can use the returned pointer - called an &amp;#8220;interior pointer&amp;#8221; - to munge with the string data in a fairly intuitive &amp;#8220;native&amp;#8221; way, as in this example code:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face=Arial size=2&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" color=#0000ff&gt;#using&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt; &amp;lt;mscorlib.dll&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" color=#0000ff&gt;#include&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt; &amp;lt;vcclr.h&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" color=#0000ff&gt;using&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt; &lt;SPAN&gt;namespace&lt;/SPAN&gt;&lt;/FONT&gt; System;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" color=#0000ff&gt;int&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt; main(){&amp;nbsp;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;String *s = S"abcdefg";&amp;nbsp;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;FONT color=#0000ff&gt;&lt;SPAN&gt;wchar_t&lt;/SPAN&gt; &lt;SPAN&gt;__gc&lt;/SPAN&gt;*&lt;/FONT&gt; pc = PtrToStringChars(s);&amp;nbsp;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;for&lt;/SPAN&gt;(&lt;SPAN&gt;&lt;FONT color=#0000ff&gt;int&lt;/FONT&gt;&lt;/SPAN&gt; i=0; i&lt;S-&gt;Length; i++){&amp;nbsp;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;*(pc+i)+=1; &lt;/FONT&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008000&gt;//increment each character in the string&lt;/FONT&gt;&amp;nbsp;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;}&amp;nbsp;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;Console::WriteLine(pc);&lt;SPAN&gt;&amp;nbsp;&lt;FONT color=#008000&gt; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008000&gt;//writes "bcdefgh"&lt;/FONT&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;Yeah, but I wanted to use a native function.&lt;/STRONG&gt;&amp;nbsp; I'm getting there.&amp;nbsp; Now, you can't convert from a &lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;__gc&lt;/FONT&gt;*&lt;/FONT&gt; to a &lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;__nogc&lt;/FONT&gt;*&lt;/FONT&gt; (&amp;#8220;native pointer&amp;#8220;), but you can convert from a &lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;__gc&lt;/FONT&gt;*&lt;/FONT&gt; to another type - &lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;__pin&lt;/FONT&gt;*&lt;/FONT&gt; - which has a conversion to a &lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;__nogc&lt;/FONT&gt;*&lt;/FONT&gt;:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;SPAN&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;#using&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; &amp;lt;mscorlib.dll&amp;gt;&lt;MSCORLIB.DLL&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;#include&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; &amp;lt;vcclr.h&amp;gt;&lt;VCCLR.H&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;using&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;namespace&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; System;&lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;int&lt;/FONT&gt;&lt;FONT size=2&gt; unmanagedStrLenFunction(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;wchar_t&lt;/FONT&gt;&lt;FONT size=2&gt; *c){ &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008000 size=2&gt;//counts the length of c&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp; int&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; count=0;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp; while&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;(*c){&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;count++;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;c++; &lt;/FONT&gt;&lt;FONT face="Courier New" color=#008000 size=2&gt;//heh&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;&amp;nbsp; }&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp; return&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt; count;&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;int&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; main(){&lt;BR&gt;&amp;nbsp; String *s = S"abcdefg";&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp; wchar_t&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;__gc&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;* pc = PtrToStringChars(s);&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp; wchar_t&lt;/FONT&gt;&lt;FONT size=2&gt; &lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;__pin&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt;* ppc = pc;&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;&amp;nbsp; int&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT size=2&gt; x = unmanagedStrLenFunction(ppc);&lt;BR&gt;&amp;nbsp; Console::WriteLine(&lt;/FONT&gt;&lt;FONT color=#0000ff size=2&gt;__box&lt;/FONT&gt;&lt;FONT size=2&gt;(x)); &lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#008000 size=2&gt;//writes "7"&lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial&gt;I could have turned the result of &lt;FONT face="Courier New"&gt;PtrToStringChars&lt;/FONT&gt; directly into a &lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;wchar_t __pin&lt;/FONT&gt;*&lt;/FONT&gt; directly, but I wanted to make it absolutely clear.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;Wow!&amp;nbsp; Pin pointers are cool!&amp;nbsp; I'm going to use them everywhere!&lt;/STRONG&gt;&amp;nbsp; Whoa there, trigger.&amp;nbsp;There are a few things to keep in mind about pin pointers:&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;They can be extremely costly.&lt;/STRONG&gt;&amp;nbsp; The pin pointer works by literally pinning the enclosing type down, so the GC collector can't move it around when its doing collections.&amp;nbsp; Do this too often, or keep the pin pointer around for a relatively long time, and you're seriously hurting the performance of the garbage collector - not a good idea.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;They can't be used everywhere.&lt;/STRONG&gt;&amp;nbsp; By design, because of the costliness and lifetime problems involved with pin pointers, they can't be: members of a type, function return types, function parameters, or temporary variables.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;LI&gt;
&lt;DIV&gt;&lt;SPAN&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;Pin pointers only pin objects for their lifetime.&amp;nbsp; &lt;/STRONG&gt;&lt;FONT face=Arial size=2&gt;&lt;FONT face=Arial&gt;&lt;/FONT&gt;&lt;/FONT&gt;This leaves open the possibility of GC holes.&amp;nbsp; That is, you can get a native pointer to the GC, release the pin pointer, and then leave yourself a huge GC hole.&amp;nbsp; For example:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;SPAN&gt;&lt;FONT face=Arial size=2&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" color=#0000ff&gt;__gc&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt; &lt;SPAN&gt;class&lt;/SPAN&gt;&lt;/FONT&gt; A{ &lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" color=#0000ff&gt;public&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;:&amp;nbsp;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt;&lt;/SPAN&gt; i; &lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;}; &lt;BR&gt;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New" color=#0000ff&gt;int&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;* gchole(A* a){&amp;nbsp;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp; &lt;FONT color=#0000ff&gt;int&lt;/FONT&gt;&lt;/SPAN&gt;&lt;FONT color=#0000ff&gt; &lt;SPAN&gt;__pin&lt;/SPAN&gt;&lt;/FONT&gt;* p = &amp;amp;(a-&amp;gt;i);&amp;nbsp;&lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&lt;FONT color=#0000ff&gt;return&lt;/FONT&gt;&lt;/SPAN&gt; p; &lt;BR&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;SPAN&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;What's so wrong with that code?&lt;/STRONG&gt;&amp;nbsp; On the surface, it looks pretty benign.&amp;nbsp; But remember that the object passed in (&lt;FONT face="Courier New"&gt;a&lt;/FONT&gt;) is only pinned for the lifetime of the pin pointer &lt;FONT face="Courier New"&gt;p&lt;/FONT&gt;.&amp;nbsp; So, when the function returns, you have a native pointer into the GC heap, which would be safe, except &lt;FONT face="Courier New"&gt;p&lt;/FONT&gt; has been destroyed.&amp;nbsp; So, instead, you have a GC hole.&amp;nbsp; The pointer returned from the function &lt;FONT face="Courier New"&gt;gchole&lt;/FONT&gt; is only going to be valid until the next garbage collection - and who knows when that will happen.&amp;nbsp; In short, don't do this, if you want to avoid unexplainable, untraceable, unreproduceable&amp;nbsp;application crashes.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;SPAN&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;Back to the original question, what about regular &lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;char&lt;/FONT&gt;*&lt;/FONT&gt;'s?&amp;nbsp; &lt;/STRONG&gt;No chance, not without incurring a copy cost (either by using API functions that turn &lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;wchar_t&lt;/FONT&gt;*&lt;/FONT&gt;'s into &lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;char&lt;/FONT&gt;*&lt;/FONT&gt;'s, or by marshalling).&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;SPAN&gt;&lt;FONT face=Arial&gt;In a future article, I'll describe the new syntax versions of the pinning and interior pointer, and some of the (mostly minor) differences.&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=45219" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/articles/default.aspx">articles</category><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item><item><title>The native heap/managed heap barrier</title><link>http://blogs.msdn.com/arich/archive/2003/12/22/45168.aspx</link><pubDate>Mon, 22 Dec 2003 19:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:45168</guid><dc:creator>arich</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/arich/comments/45168.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=45168</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Garrett asks:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT size=2&gt;You mentioned: &lt;BR&gt;&lt;BR&gt;class A{}; array&lt;A*&gt;^ arr = gcnew array&lt;A*&gt;(10);. &lt;BR&gt;&lt;BR&gt;Are you saying that whidbey will support this? What is it doing to the native pointer? Boxing? &lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;Managed array of native pointers to native objects?&amp;nbsp; &lt;/STRONG&gt;This didn't work in Everett, but it will in Whidbey.&amp;nbsp; It probably wasn't a hard fix.&amp;nbsp; Let's look a the simple case, having a native pointer inside of a managed object on the GC heap.&amp;nbsp; Take the following example:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P dir=ltr&gt;&lt;FONT face="Courier New" size=2&gt;&lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; N{}; &lt;FONT color=#008000&gt;//some native class&lt;BR&gt;&lt;/FONT&gt;&lt;FONT color=#0000ff&gt;ref&amp;nbsp;struct&lt;/FONT&gt; R{&lt;BR&gt;&amp;nbsp; N* pn;&amp;nbsp;&amp;nbsp; &lt;FONT color=#9acd32&gt;&lt;FONT color=#008000&gt;//native (__nogc) pointer to native class&lt;/FONT&gt;&lt;BR&gt;&amp;nbsp; &lt;/FONT&gt;&lt;FONT color=#000000&gt;R(){ pn = &lt;FONT color=#0000ff&gt;new&lt;/FONT&gt; N; }&lt;/FONT&gt;&lt;BR&gt;};&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;But can't the GC heap move objects around at will?&lt;/STRONG&gt;&amp;nbsp; Yes, it can. This was puzzling to me for a while, also.&amp;nbsp; Look closely at the constructor for &lt;FONT face="Courier New"&gt;R&lt;/FONT&gt;.&amp;nbsp; We are calling &lt;FONT face="Courier New" color=#0000ff&gt;new&lt;/FONT&gt; on the native object.&amp;nbsp; Not &lt;FONT face="Courier New" color=#0000ff&gt;gcnew&lt;/FONT&gt;, just regular &lt;FONT face="Courier New" color=#0000ff&gt;new&lt;/FONT&gt;.&amp;nbsp; So, the native object is going on the &lt;EM&gt;native&lt;/EM&gt; heap.&amp;nbsp; The pointer to that object might be inside &lt;FONT face="Courier New" color=#0000ff&gt;R&lt;/FONT&gt;, on&amp;nbsp;the managed heap, but the location the pointer is referencing won't move.&amp;nbsp; Imagine it like a rubber band, one end tacked down in the native heap, the other in the GC heap.&amp;nbsp; The native side holds still, doesn't move.&amp;nbsp; The managed side might be relocated, but the pointer still points to the same position in the native heap.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=45168" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item><item><title>Clarifications on the array template, and some about the CLR namespaces</title><link>http://blogs.msdn.com/arich/archive/2003/12/19/44718.aspx</link><pubDate>Fri, 19 Dec 2003 19:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:44718</guid><dc:creator>arich</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/arich/comments/44718.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=44718</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Garrett returns with some observations:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT size=2&gt;Damn Cool. My only reservation is that it doens't *resemble* a native array, but that's ok too :)&amp;nbsp;&amp;nbsp; In some ways that is far better than the alternative. I was never quite thrilled about the cryptic nature of managed arrays before.&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Yeah, us either.&amp;nbsp; That's why we did it. :)&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT size=2&gt;Is then the syntax for a managed array of managed objects: &lt;BR&gt;array&amp;lt;Object^&amp;gt;^ array = gcnew array&amp;lt;Object^&amp;gt;(10);&amp;nbsp;? &lt;BR&gt;&lt;BR&gt;Otherwise, I would assume that if you didn't need the ^ inside the &amp;lt;&amp;gt; you wouldn't be prepared for native garbage collected types in a post Whidby release.&lt;/FONT&gt; &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;Yup, you hit the nail on the head.&amp;nbsp; I only showed value types, for simplicity's sake, but ref types you'll also want to be able to put in a managed array.&amp;nbsp; And yes, the syntax you've provided is correct.&amp;nbsp; If you want a size 10 array of managed strings, you do &lt;FONT face="Courier New"&gt;array&amp;lt;String^&amp;gt;^ strarr = &lt;FONT color=#0000ff&gt;gcnew&lt;/FONT&gt; array&amp;lt;String^&amp;gt;(10);&lt;/FONT&gt;&lt;FONT face=Arial&gt;.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;And your reasoning seems valid, too.&amp;nbsp; &lt;/FONT&gt;&lt;FONT face=Arial size=2&gt;It is worth pointing out that you can also do managed arrays of native pointers to native types:&amp;nbsp; &lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;class&lt;/FONT&gt; A{};&amp;nbsp; array&amp;lt;A*&amp;gt;^ arr = &lt;FONT color=#0000ff&gt;gcnew&lt;/FONT&gt; array&amp;lt;A*&amp;gt;(10);&lt;/FONT&gt;&lt;FONT face=Arial&gt;.&amp;nbsp; I'll let you fill in the blanks as to where we can take that post-Whidbey.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;Garrett also asks:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT size=2&gt;I notice that the namespace using went from &lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp; #using &amp;lt;mscorlib.dll&amp;gt; &lt;BR&gt;&amp;nbsp;&amp;nbsp; using namespace System; &lt;BR&gt;&lt;/FONT&gt;to &lt;BR&gt;&lt;/FONT&gt;&lt;FONT size=2&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp; using namespace stdcli::language; &lt;BR&gt;&lt;/FONT&gt;Is there a new "mapping" of namespaces going on here? Is the "System" namespace replaced with "stdcli::language" ? &lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;FONT face=Arial&gt;&lt;/FONT&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;No, and its totally my fault for not explaining what was going on.&amp;nbsp; This is why you should never rush blog posts, people! :)&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;First, why the &lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;#using&lt;/FONT&gt; &amp;lt;mscorlib.dll&amp;gt;&lt;/FONT&gt; disappeared.&amp;nbsp; In Managed Extensions, you compile with /clr, and then are required to put the &lt;FONT face="Courier New" color=#0000ff&gt;#using&lt;/FONT&gt; at the start of &lt;EM&gt;every file&lt;/EM&gt;.&amp;nbsp; When doing Whidbey C++, we realized that if we're requiring it at the start of every file, we could just put it in for you, so we did.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;Second, about the namespaces.&amp;nbsp; The &lt;FONT face="Courier New"&gt;System&lt;/FONT&gt;&lt;FONT face=Arial&gt; namespace still exists, and is quite vital.&amp;nbsp; A &lt;STRONG&gt;&lt;EM&gt;lot&lt;/EM&gt;&lt;/STRONG&gt; of stuff is under that namespace.&amp;nbsp; But in my example, I didn't use anything from that namespace (except for the one &lt;FONT face="Courier New"&gt;System::Console::WriteLine&lt;/FONT&gt;, which you'll notice was fully qualified).&amp;nbsp; Its the &lt;FONT face="Courier New"&gt;array&lt;/FONT&gt; type that is in the &lt;FONT face="Courier New"&gt;stdcli::language&lt;/FONT&gt; namespace, along with a few other types (&lt;FONT face="Courier New"&gt;pin_ptr&lt;/FONT&gt; and &lt;FONT face="Courier New"&gt;interior_ptr&lt;/FONT&gt;, which I'll talk about at a later date).&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;The justification for putting the &lt;FONT face="Courier New"&gt;array&lt;/FONT&gt; type in that namespace is pretty straightforward: people have &lt;FONT face="Courier New"&gt;array&lt;/FONT&gt; as an identifier all over the place.&amp;nbsp; We simply couldn't make it a general keyword and break them.&amp;nbsp; So, we put it inside a namespace.&amp;nbsp;&amp;nbsp; That way, you could have &lt;FONT face="Courier New"&gt;array&lt;/FONT&gt; as an identifier, and then fully qualify the &lt;FONT face="Courier New"&gt;stdcli::language::array&lt;/FONT&gt;&amp;nbsp;type when you wanted to use it.&amp;nbsp; Or, if you were writing a new program, or knew you had no instances of an identifier named &lt;FONT face="Courier New"&gt;array&lt;/FONT&gt;, you could just do a &lt;FONT face="Courier New"&gt;using&lt;/FONT&gt; on the namespace safely.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;If you ever wonder about why the language design team made a choice they made, you can almost always be certain the reason is because they didn't want to break existing users.&amp;nbsp; They make every effort not to.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=44718" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item><item><title>Why you ought not pre-jit, and why it sometimes makes sense.</title><link>http://blogs.msdn.com/arich/archive/2003/12/19/44708.aspx</link><pubDate>Fri, 19 Dec 2003 18:51:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:44708</guid><dc:creator>arich</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/arich/comments/44708.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=44708</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;So,&amp;nbsp;Raj asks:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;&lt;FONT size=2&gt;Thanks for the explanation but what is the deal with the IL and JIT. Why not just prejit the code?&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;Why not pre-jit the code?&amp;nbsp;&lt;FONT face=Arial size=2&gt;&lt;/STRONG&gt;&lt;/FONT&gt;Class, you didn't do the &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/dotnetperftechs.asp"&gt;required reading&lt;/A&gt;.&amp;nbsp;:)&amp;nbsp; Actually, there are a couple of optimization reasons why you don't pre-jit code.&amp;nbsp; Most of it deals with this basic tenet: the JIT is around when the compiler isn't.&amp;nbsp; It can know things about the runtime environment the compiler has no way of figuring out, and perform other optimizations.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;The JIT only generates the code it needs to.&lt;/STRONG&gt;&amp;nbsp; It doesn't need to generate the code for a method that the program isn't going to use on a particular execution, so you don't incur the cost of jitting your entire program every time.&amp;nbsp; Only what needs to be is jitted, and the rest is jitted as necessary.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;Agressive Inlining.&lt;/STRONG&gt;&amp;nbsp; No, this doesn't mean buying a step-up kit for your rollerblades so you can go grinding.&amp;nbsp; Basically, it allows methods that are called often to gain a speed advantage over methods that are called less often.&amp;nbsp; The native C++ backend has something similar, called POGO (Profile-Guided Optimization).&amp;nbsp; But even that can't optimize as specifically as a JIT can - the JIT can optimize each time the program is executed.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;But, what if I still want to pre-jit?&lt;/STRONG&gt;&amp;nbsp; Well, you still can.&amp;nbsp; We provide a tool with the framework called ngen.exe, which allows you to take the cost of jitting the code once, say, at installation time.&amp;nbsp; You gain the advantage of faster start-up time, but you lose the advantages listed above (among others that are more technical than I can explain well).&amp;nbsp; The author of the article I linked to mentions two places where you might want to pre-jit:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;The first situation is where you call an enormous number of methods early on in your program. You'll have to JIT a lot of methods up front, resulting in an unacceptable load time. This is not going to be the case for most people, but pre-JITing might make sense if it affects you. Precompiling also makes sense in the case of large shared libraries, since you pay the cost of loading these much more often. Microsoft precompiles the Frameworks for the CLR, since most applications will use them.&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;So, there's a time and a place for everything.&amp;nbsp; In fact, we're still fully supporting native C++ compliation in Visual C++ Whidbey, because sometimes a native program makes more sense than a managed one.&amp;nbsp; (For example, device drivers.)&amp;nbsp; But by and large, you want to write managed code, because its easier and more portable, and you want to use the JIT, because in most situations it is to your advantage to do so.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=44708" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item><item><title>Dave strikes again, a basic description of how .NET works.</title><link>http://blogs.msdn.com/arich/archive/2003/12/18/44545.aspx</link><pubDate>Fri, 19 Dec 2003 03:30:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:44545</guid><dc:creator>arich</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/arich/comments/44545.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=44545</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Dave asks:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size=2&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;i have tried some UI examples in the book, but it was quite slow. when I execute the program, it takes 1.5-2seconds to see the window on the screen, on the other hand plain win32 api creates window before 1st second. doesn't .net generate native win32 binary code? what does it load/do delaying application so long?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;What exactly IS .NET?&amp;nbsp; &lt;/STRONG&gt;First, .NET is a cross-language&amp;nbsp;application framework - the same types and methods that you access in C++ are accessed in different (sometimes the same) way in C#, VB.NET, ASP.NET, and so on.&amp;nbsp; (This is why, when I talk about a managed C++ feature, I usually say it is &lt;EM&gt;exposed&lt;/EM&gt; in Whidbey C++.)&amp;nbsp; Since the Common Language Specification (CLS) is an ECMA standard, and freely available, expect to see more (including non-Microsoft)&amp;nbsp;language implementations&amp;nbsp;targeting the .NET framework in the near future.&amp;nbsp; (&lt;A href="http://aspn.activestate.com/ASPN/Downloads/PerlASPX/"&gt;.NET perl&lt;/A&gt;, anyone?)&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial&gt;In order for multiple languages to&amp;nbsp;apply to a single framework, an&amp;nbsp;assembler-type language is used, called Microsoft Intermediate Language, or &lt;A href="http://www.csharphelp.com/archives/archive166.html"&gt;MSIL&lt;/A&gt;.&amp;nbsp; All .NET-targeted languages compile their code to MSIL (in C++'s case, a mixture of native code and MSIL).&amp;nbsp; The MSIL is then compiled to native machine code on-the-fly by a JIT (Just-In-Time) compiler.&amp;nbsp; The JIT is basically a VM, similar in concept to the Java VM.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;So, why is my sample slow?&amp;nbsp; &lt;/STRONG&gt;The performance hit you see (why the program takes a few seconds to load as opposed to miliseconds) is the JIT compiling your code.&amp;nbsp; However, we take this tradeoff for a number of performance benefits the JIT provides.&amp;nbsp; These performance&amp;nbsp;benefits are &lt;EM&gt;nearly invisible&lt;/EM&gt; in small programs - such as examples - and &lt;EM&gt;hugely beneficial&lt;/EM&gt; in large applications.&amp;nbsp; I'm not going to go into them here, because other people have done it better.&amp;nbsp;&amp;nbsp;Stay tuned for a &lt;STRONG&gt;really great&lt;/STRONG&gt; link on the perf benefits of the CLR.&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P dir=ltr&gt;i am really into it, but i have a question &amp;amp;&amp;amp; suggestion; why you are providing a garbage collector? instead of that, it would be better to track memory leaks with visual studio .net ide, like BoundsChecker was doing with vs6. because garbage collector is using system resources, may be it causes cache misses, too. of course, i have no idea about its implementation, you engineers probably considered such cases.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;Do we really want/need a Garbage Collector?&lt;/STRONG&gt;&amp;nbsp; This isn't the first time I've heard this - and almost always from C++ users, too.&amp;nbsp; We're such a type-A breed, always wanting to do things ourselves (mostly out of speed considerations).&amp;nbsp; But the short-term losses you might perceive in the overhead of a GC are far outweighed by the benefits you reap.&amp;nbsp; Again, I'm going to provide a link, I promise.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial&gt;(To be totally clear, it isn't C++'s Garbage Collector.&amp;nbsp; It is the .NET GC, and we're simply leveraging it.&amp;nbsp; All .NET targetted languages are, by default, garbage collected.)&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;What about low-overhead solutions like BoundsChecker?&lt;/STRONG&gt;&amp;nbsp; Well, on the surface, these seem to be good solutions, but they aren't always.&amp;nbsp; First, consider that the GC performs optimizations that&amp;nbsp;non-GC environments (native C++) can't take advantage of.&amp;nbsp; For example, choosing when to destruct/collect an object.&amp;nbsp; In native you have to do it when the stack is being unwound (even if the CPU is at 99% usage) - in the GC world, you could choose to wait for processor lull.&amp;nbsp; Second, solutions that look for memory holes only find the holes you create - you still have to patch them up.&amp;nbsp; With the GC, you can't create memory holes, that worry simply never crosses your mind.&amp;nbsp; (And besides, not to slam the IDE team, but do you really want the IDE - which you pointed out can't seem to&amp;nbsp;manage its &lt;EM&gt;own&lt;/EM&gt; memory leaks - trying to manage &lt;EM&gt;yours&lt;/EM&gt;?)&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial&gt;&lt;STRONG&gt;So, where's that link?&lt;/STRONG&gt;&amp;nbsp; There's a great article on MSDN that has an explanation/justification of all the benefits provided by the .NET framework - and the theory behind why managed code isn't slower than native, and why it has the ability to be faster.&amp;nbsp; It has sections on the GC, the JIT, Thread Pooling, Appdomains, and so on and so forth.&amp;nbsp; It even has an Overview of the .NET framework, if my crappy one-paragraph explaination above wasn't sufficient for you.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial&gt;Anyhow, if you want to know more, I &lt;STRONG&gt;strongly &lt;/STRONG&gt;encourage you to check out &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/dotnetperftechs.asp"&gt;&lt;FONT face=Arial&gt;this article&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Arial&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=44545" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item><item><title>VC++ .NET Examples, a tiny Visual Studio timeline, how to participate in the Whidbey Beta</title><link>http://blogs.msdn.com/arich/archive/2003/12/17/44187.aspx</link><pubDate>Wed, 17 Dec 2003 19:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:44187</guid><dc:creator>arich</dc:creator><slash:comments>6</slash:comments><comments>http://blogs.msdn.com/arich/comments/44187.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=44187</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Reader Dave commented:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;back to lack of visual c++ .net examples. I saw that there are lots of c# examples, this is good because C# is a new language and if i am correct, it is built for .net. there are vb.net examples, too, but there is not a visual c++ .net example displaying a window on the screen (or i didnt see any). so i am playing with console and sockets, and it is getting boring.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;I did a little digging, and came up with some&amp;nbsp;&lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcsample/html/vcoricategoricallistofmanagedextensionsforcsamples.asp"&gt;samples&lt;/A&gt; for Visual C++ .NET that you might not have seen.&amp;nbsp; I believe these examples were made for VC++ 7.0, and not for 7.1.&amp;nbsp; The samples cover a wide variety, including some dealing with Windows Forms, which should get your feet wet with the .NET UI APIs.&amp;nbsp; (If you're looking for some VC++ 7.1 / Codename Everett&amp;nbsp;examples, you might be interested in looking &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyId=6E6FAC4B-5B51-41FE-9604-1D9752E8A71A&amp;amp;displaylang=en"&gt;here&lt;/A&gt;.)&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P dir=ltr&gt;i see whidbey samples everywhere, in your blog for instance, but not much examples for vs2002. it seems i need to upgrade vs2003 as soon as possible.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;FONT face=Arial size=2&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;There are plenty of good reasons to &lt;A href="http://msdn.microsoft.com/visualc/productinfo/topten/upgrade02.aspx"&gt;upgrade from .NET 2002 to .NET 2003&lt;/A&gt;&amp;nbsp;(and &lt;A href="http://www.ftponline.com/wss/2003_02/magazine/features/nruest/"&gt;don't just take our word&lt;/A&gt; for it.)&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;But, there may be some confusion on the generations of Visual Studio (and of our compiler), so I'm going to try and clear it up.&amp;nbsp; Since Visual Studio 6, there have been two releases.&amp;nbsp; Visual Studio 7.0 (&amp;#8221;Visual Studio .NET&amp;#8221;) and Visual Studio 7.1 (&amp;#8221;Visual Studio .NET 2003&amp;#8221;).&amp;nbsp; I don't know about the other products, so I won't try and outline the changes for anything but Visual C++ between these releases.&amp;nbsp; &lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;VC++ 7.0&lt;/STRONG&gt;, also known as Visual&amp;nbsp;C++&amp;nbsp;.NET 2002,&amp;nbsp;was the first product to contain Managed Extensions.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;VC++ 7.1&lt;/STRONG&gt;, also known&amp;nbsp;as Visual&amp;nbsp;C++ .NET 2003, also known as Codename Everett, is a great compiler, and Microsoft's latest public offering.&amp;nbsp; It has a whole lot of standards and conformance work, and other increases in perf, stability, etc.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;Codename Whidbey&lt;/STRONG&gt;, the compiler we're working on currently, is the only compiler to feature the new managed syntax I'm always blathering on about in my blog.&amp;nbsp; It isn't in public release yet (there's an Alpha program currently), but we'll have a Beta hopefully in the next six months.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;If you're interested in participating in the Beta, you can &lt;A href="http://www.beta.microsoft.com/"&gt;sign up here&lt;/A&gt;.&amp;nbsp; Enter your Passport information, use 'BetaReq' (case &lt;EM&gt;sensitive&lt;/EM&gt;) as your guest login, and fill out the survey.&amp;nbsp; If you're lucky, you'll be part of the Whidbey Beta program.&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=44187" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item><item><title>A little Q&amp;A</title><link>http://blogs.msdn.com/arich/archive/2003/12/16/43898.aspx</link><pubDate>Tue, 16 Dec 2003 19:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:43898</guid><dc:creator>arich</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/arich/comments/43898.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=43898</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Reader Dave asks:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;I am using Visual Studio 7.0 (2002?). I turn on my computer in the morning, and run it until midnight and my visual studio is always open. however, it consumes 60-150MB Virtual memory, specifically when i use VisualPerl (I usually use Visual C++). sometimes i need to run two instances of visual studio, but virtual memory usage keeps growing in both processes. do you know any fixes, or suggestions? &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;I talked to some of the people who are involved in providing support for previous versions (something at Microsoft that is typically dubbed &amp;#8220;sustained engineering&amp;#8220;).&amp;nbsp; They tell me that, unfortunately, memory leaks in the IDE (such as the one you are experiencing) are typically low-priority, and not as likely to be fixed as language design flaws or serious limitations in compiler functionality.&amp;nbsp; The fact that the problem is most noticable in a &lt;A href="http://www.activestate.com/Products/Visual_Perl/"&gt;third party add-in&lt;/A&gt;&amp;nbsp;suggests it might not even be a problem primarily with the VS product.&amp;nbsp; My only suggestions in this area are to contact ActiveState, to see if they are working on a fix for your problem, or to install any &lt;A href="http://msdn.microsoft.com/vstudio/previous/2002/downloads/default.aspx"&gt;relevant VS .NET 2002 updates&lt;/A&gt;. (Though, it doesn't appear there are any addressing this specific problem.)&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;as i have posted in my prior posts, i have never used .net. i will say one more thing, but i dont know if it is correct, so it contains a question as well; we dont need windows forms or anything else dealing with user-interface to run a service at the server, right?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;That's correct, you don't need windows forms to write a service.&amp;nbsp; Windows forms are just a way to describe user interface - typically, services (especially&amp;nbsp;FreeBSD/Linux/etc. ones) handle user interface through config files, command-line options, or some kind of limited console interaction.&amp;nbsp; All of which should be supported by Rotor through the various CLI namespaces (System::Console, System::IO, etc.).&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=43898" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item><item><title>Mono, more on cross-platform</title><link>http://blogs.msdn.com/arich/archive/2003/12/11/42873.aspx</link><pubDate>Thu, 11 Dec 2003 19:39:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:42873</guid><dc:creator>arich</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/arich/comments/42873.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=42873</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;A href="http://www.go-mono.com/"&gt;Mono&lt;/A&gt; (very different from&amp;nbsp;&lt;A href="http://kidshealth.org/parent/infections/bacterial_viral/mononucleosis.html"&gt;mono&lt;/A&gt;), is, at its core, an implementation of the Common Language Specification - which we purposefully made &lt;A href="http://www.dotnetexperts.com/ecma/"&gt;public domain&lt;/A&gt; through &lt;A href="http://www.ecma-international.org"&gt;ECMA&lt;/A&gt;.&amp;nbsp; Mono is pretty cool, too, and I'm personally glad to see it.&amp;nbsp; They even &lt;A href="http://www.go-mono.com/rationale.html"&gt;praise&lt;/A&gt; the standard Microsoft helped develop:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;The Common Language Infrastructure platform is similar to the goals we had in GNOME of giving language independence to programmers. It is more mature, documented, larger in scope, and has a consistent design. &lt;/P&gt;
&lt;P&gt;What makes the Common Language Infrastructure development platform interesting is that it is a good mix of technologies that have been nicely integrated.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;Which is a welcome change from what we usually &lt;A href="http://www.slashdot.org/"&gt;hear&lt;/A&gt; from the open-source community.&amp;nbsp; Garrett mentioned:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial&gt;&lt;FONT size=2&gt;&lt;FONT face="Times New Roman" size=3&gt;Without System::Windows::Forms , having the CLR on Mac OS X and FreeBSD is kinda like a mule with spinning wheel : no-one knows how he got it, and be damned if he knows how to use it :)&lt;/FONT&gt; &lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;Well, &lt;A href="http://www.snpp.com/episodes/9F10.html"&gt;Lyle&lt;/A&gt;... I mean Garrett, remember that the SSCLI is in its first version - not everything is there yet.&amp;nbsp; And &lt;A href="http://gtk-sharp.sourceforge.net/"&gt;GTK#&lt;/A&gt; looks like a fairly good idea.&amp;nbsp; But the truth is that Windows::Forms is a COM-interop wrapper for the native Win32 GDI, which hasn't been ported to other platforms, and likely won't be - except by those great people over at&amp;nbsp;&lt;A href="http://www.winehq.com/"&gt;WINE&lt;/A&gt;&amp;nbsp;:).&amp;nbsp; What you ought to be wondering about is &lt;A href="http://download.microsoft.com/download/a/2/f/a2fc47d2-8bdf-4977-8364-1f38b893dba5/pdc_namespaceposter.pdf"&gt;WinFX&lt;/A&gt;.&amp;nbsp; And I don't know the answer to that question...&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=42873" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item><item><title>C++ feature "lag," native types on the GC Heap, a plug for some software I like</title><link>http://blogs.msdn.com/arich/archive/2003/12/11/42854.aspx</link><pubDate>Thu, 11 Dec 2003 18:48:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:42854</guid><dc:creator>arich</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/arich/comments/42854.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=42854</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Garrett points out:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;I *am* a tad sad that C++ tends to lag a generation behind C# on features in .NET. &lt;BR&gt;&lt;BR&gt;I realize that's likely due to the larger effort required, with less resources than C#, and it seems that C++ is less ...sexy... than C#, but it's still sad . :( &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;Yes, it is true that C# is ahead of the game when it comes to new features - but you have to realize that we were at a disadvantage from the start.  The goals of our language redesign are very different from the goals of the C# team.  I tend to think they have it easy: their language is already made to target the CLR.  That's it, nothing more, nothing less.  We're trying to give our users the best of both worlds: native and managed.  All at once.  It's a difficult task, to say the least.  Having said that, it is unfortunate that C# is half a step ahead of us.  But they had a head-start - and we've closed the gap considerably.  I can only imagine that we'll be on-par (maybe a little ahead) by our next release.  (Psst... codename &lt;EM&gt;Orcas&lt;/EM&gt;.)&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P dir=ltr&gt;How far off is that intent to put native types into the GC Heap? &lt;BR&gt;&lt;BR&gt;I can see this as being a VERY handy feature, basically adding Garbage collection to native code. This will very quickly help cure some memory leaks and crappy code :) &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;I'm not certain I'm allowed to speak on this issue in specifics without violating some sort of NDA.  I can say, what you are looking almost certainly &lt;EM&gt;isn't&lt;/EM&gt; coming in Whidbey.  But it &lt;STRONG&gt;&lt;U&gt;is&lt;/U&gt;&lt;/STRONG&gt;&lt;EM&gt; &lt;/EM&gt;on the horizon. For sure.  We want it just as badly as you do.  I'd watch &lt;A href="http://blogs.gotdotnet.com/hsutter"&gt;Herb Sutter's&lt;/A&gt; blog for more on that, he's come close to talking about it a couple of times.  In fact, he's already &lt;A href="http://blogs.gotdotnet.com/hsutter/permalink.aspx/6cf22d51-46c2-41bb-8e75-ed5e495ff271"&gt;said&lt;/A&gt; the following:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P xmlns="http://www.w3.org/1999/xhtml"&gt;In my previous blog entry, I listed two reasons not to conflate the type category with where objects of that type can be allocated, namely to let us in the future support allocating native types on the GC heap, and CLI types on the native heap. The decision to garbage-collect or not should not be per-type (as it was in MC++), but per-object. &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;By the way&lt;/STRONG&gt;, if you're trying to keep track of multiple blogs, I highly suggest &lt;A href="http://www.newsgator.com/"&gt;Newsgator&lt;/A&gt;.  It aggregates blogs (using their RSS feeds) and dumps it into Outlook for you.  Convenient!&lt;/FONT&gt;&lt;BR&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=42854" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item><item><title>Will .NET be available for non-Windows platforms?</title><link>http://blogs.msdn.com/arich/archive/2003/12/10/42648.aspx</link><pubDate>Wed, 10 Dec 2003 23:53:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:42648</guid><dc:creator>arich</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/arich/comments/42648.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=42648</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;I thought this deserved a post, and not be buried in a comment.  Dave asks:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;Wow! it seems you are empowering c++ for CLR. will .net be available for non-windows platforms?&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;IT ALREADY IS!&lt;/STRONG&gt;  Being Microsoft, you'd think .NET would be a Windows-only innovation.  But, happily, it isn't.  My buddy &lt;A href="http://blogs.gotdotnet.com/joelpob/"&gt;Joel&lt;/A&gt; is PM of the Rotor team, which is working to bring the CLI (Common Language Infrastructure - the core of the .NET Framework) and the C# compiler to other platforms.  Check out the &lt;A href="http://msdn.microsoft.com/net/sscli/"&gt;SSCLI 1.0 release&lt;/A&gt; - which already builds on WindowsXP, FreeBSD, and Mac OS X 10.2, released under Microsoft's &lt;A href="http://www.microsoft.com/resources/sharedsource/default.mspx"&gt;Shared Source Initiative&lt;/A&gt;.  As Joel says, boot your FreeBSD box, download, untar, build, have a cup of coffee, and start playing with the CLR &lt;STRONG&gt;&lt;EM&gt;today&lt;/EM&gt;&lt;/STRONG&gt;!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;(Ripped from the download page for SSCLI 1.0):&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;The Shared Source CLI archive contains the following technologies in source code form: &lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;An implementation of the runtime for the Common Language Infrastructure (ECMA-335) that builds and runs on Windows XP, the FreeBSD operating system, and Mac OS X 10.2. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Compilers that work with the Shared Source CLI for C# (ECMA-334) and JScript. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Development tools for working with the Shared Source CLI such as assembler/disassemblers (ilasm, ildasm), a debugger (cordbg), metadata introspection (metainfo), and other utilities. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;The Platform Adaptation Layer (PAL) used to port the Shared Source CLI from Windows XP to FreeBSD and Mac OS X. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Build environment tools (nmake, build, and others). &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Documentation for the implementation. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;Test suites used to verify the implementation. &lt;/FONT&gt;
&lt;LI&gt;&lt;FONT face=Arial size=2&gt;A rich set of sample code and tools for working with the Shared Source CLI. &lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;What about the C++/CLI binding on non-Windows platforms?&lt;/STRONG&gt; Well, Microsoft isn't typically in the business of making compilers for non-Windows platforms.  But &lt;A href="http://blogs.gotdotnet.com/hsutter/"&gt;Herb Sutter&lt;/A&gt;, with lots of collaboration with other groups (&lt;A href="http://www.plumhall.com/"&gt;Plum Hall&lt;/A&gt;, &lt;A href="http://www.edg.com/"&gt;EDG&lt;/A&gt;, and &lt;A href="http://www.dinkumware.com/"&gt;Dinkumware&lt;/A&gt;), are hard at work &lt;A href="http://www.ecma-international.org/news/ecma-TG5-PR.htm"&gt;standardizing the C++/CLI binding&lt;/A&gt; with the &lt;A href="http://www.ecma-international.org/"&gt;ECMA Standards Group&lt;/A&gt;.  Then, there will be a standard that can be used by other groups and companies to develop C++ compilers those non-Windows platforms that can target the CLI, which will be available on those platforms through Rotor.  We're even working with the C and C++ standards groups to try and bring some of our innovations to the language into those standards!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Arial size=2&gt;Thanks for the question, Dave!  And you're right about the empowerment - but it isn't C++ we're empowering for CLR - it's our &lt;STRONG&gt;&lt;EM&gt;USERS&lt;/EM&gt;&lt;/STRONG&gt;!&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=42648" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item><item><title>More questions, more clarifications.</title><link>http://blogs.msdn.com/arich/archive/2003/12/10/42622.aspx</link><pubDate>Wed, 10 Dec 2003 22:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:42622</guid><dc:creator>arich</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/arich/comments/42622.aspx</comments><wfw:commentRss>http://blogs.msdn.com/arich/commentrss.aspx?PostID=42622</wfw:commentRss><description>&lt;P&gt;&lt;FONT face=Arial size=2&gt;Garrett asked some further questions that were also good.  Good enough, in fact, that I didn't know the answers.  So I went down the hall and asked &lt;A href="http://blogs.gotdotnet.com/branbray"&gt;Brandon&lt;/A&gt;.  I'll paraphrase what Brandon told me here.&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;1. What about partial types? &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;What are partial types?&lt;/STRONG&gt;  For those of you unaware about partial types, I'll give some background.  A partial type is a single type, defined in multiple source files which are sort of &amp;#8220;welded&amp;#8221; together.  In the C++ lexicon, its like defining part of a class in one file, and then defining the rest in another.  Think &amp;#8220;out-of-line-but-still-in-line definition&amp;#8220;.  My understanding is that ASP.Net and C# will encorporate this in Whidbey (if they don't already).&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;Why do we need partial types?&lt;/STRONG&gt;  The major usefulness for partial types in C# (and potentially C++) will be in Longhorn, where you define UI through XAML - a markup language for defining UI - and write a &amp;#8220;code-behind&amp;#8221; file that adds the code for the event methods, etc.  Then you put these two together, to create a single coherent type that is compiled into part of your program.  (A whole lot more on this cool feature can be found &lt;A href="http://longhorn.msdn.microsoft.com/lhsdk/core/overviews/about%20xaml.aspx"&gt;here&lt;/A&gt;.)  The usefulness in ASP.Net is somewhat similar to this, albeit slightly more hidden from the user.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;So, will it make it into Whidbey C++?&lt;/STRONG&gt;  The short answer is probably not.  We've got a lot of other great work going on, and it just doesn't seem likely right now that we'll have time for partial types in this release.  It is something that is being very strongly considered for the next release after Whidbey.  Believe me, the usefulness is apparent, it just isn't something that we can tackle right now, with everything else on our plates.  On to the second question:&lt;/FONT&gt;&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;2. Given the statement found on Brandon Bray's blog about "Leave no room for a lower level language on the CLR than C++." , what about inline MSIL? :)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;There are actually two different reasons people want (or think they want) inline MSIL.  I'll address them seperately.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;1. I want to write inline MSIL for optimization purposes, like inline ASM.&lt;/STRONG&gt;  I toyed around with this misconception for a little while.  Truth is, the JIT is your optimizer.  And the JIT nets a per-machine optimization, which you may prevent by writing your own MSIL.  In short, the C++ compiler may produce less-than-optimal MSIL (prompting those Type-A's to want to squeeze that extra bit of perf out), but that's because there's another optimizer yet to come.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;Furthermore, writing inline &lt;EM&gt;ASM&lt;/EM&gt; isn't even a very good idea from an optimization standpoint - at best, its benefits are merely pragmatic.  At worst, it is harmful and costly. Think about inline assembler that was written five or ten years ago that's still in &lt;A href="http://office.microsoft.com/home/default.aspx"&gt;someone's&lt;/A&gt; codebase.  What type of processor was that &amp;#8220;optimized&amp;#8221; code written for?  Is the person who wrote that code still working for your company?  Do you update the assembler, or do you rewrite that code now (both painful and costly)?  C++ is largely platform-portable, and when compiled, produces highly optimized code for the platform compiled on.  You can't get that benefit with inline assembler.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;&lt;STRONG&gt;2. I want to write inline MSIL because I can't express everything the CLR allows with C++.&lt;/STRONG&gt;  This is actually the reason for Brandon's statement: &amp;#8220;&lt;A href="http://blogs.gotdotnet.com/branbray/PermaLink.aspx/847e1e45-ec1d-454b-a8ed-73d0d4643b78"&gt;There is no language lower than C++&lt;/A&gt;.&amp;#8221;  What he means by that is that we intend to represent everything feasible within the bounds of the CLR in the context of C++.  This is something that C# doesn't do - for example, &lt;FONT face="Courier New" color=#0000ff&gt;sealed abstract&lt;/FONT&gt; classes.  Do they make a whole lot of sense?  Maybe not.  Does the CLR support doing it?  If it does, then we want to support it as well.  (Incidentally, it does, and we do.)  The hope is that you would never &lt;EM&gt;need&lt;/EM&gt; to resort to inline MSIL to do what you want - you can just use C++ to do it.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;However, C++ isn't about what we think you need to do, its about what you need to do, and there may be a justifiable reason for writing inline MSIL.  I can't really come up with one, but that doesn't mean one doesn't exist.  The design team is considering adding inline MSIL to VC++ - however, again, most likely not in Whidbey.&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face=Arial size=2&gt;Great questions!&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=42622" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/arich/archive/tags/post+responses/default.aspx">post responses</category></item></channel></rss>