File size

File size

File size

File size

File size

194.1 MB

We're back with the second installment of C9::GoingNative and we have a great show for you! Thanks for being patient and for all the excellent feedback and support for GN! We are listening to you and will continue to adjust the show based on your feedback (note the background—less motion, but not completely void of animation). Early on, we received a request to spend some time on the CRT. Here, we do just that. Mahmoud Saleh is the STL of the CRT (now, in this case STL refers to both Stephan T. Lavavej—our hero—and of course it also means Standard Template Library, the code Stephan maintains and improves. Mahmoud maintains and improves the CRT (C Run-Time Libraries)).

Charles and a few fellow C++ and Beyond attendees share perspectives on this great event for C++ developers. And looking forward, you'll see some great C++ and Beyond content on C9 over the coming months and well, yesterday: Watch the C++ and Beyond C9 interview with Herb, Scott, and Andrei..Table of Contents(click time code links to navigate player accordingly)

We really want to hear from you, so please tweet feedback to @C9GoingNative (follow us!)and send your requests, ideas, complaints, praises, hate mail, and love letters to C9GoingNative at hotmail com. We will read and respond to all messages! That's how we roll, brothers and sisters. If you are a Facebook user, then please join our C9::GoingNative Facebook group.

The CRT talk with Mahmoud Saleh is really interesting, and it looks like we could spend an entire hour (or even more) talking about the design and the possibilities of the CRT. Charles, any thoughts on a lecture series or a GD episode on the subject?

The VC.next improvements look nice. My biggest issue with the VC IDE by far is speed. The IDE runs way too slowly, particularly the Intellisense. Intellisense kind of loses its value if you have to wait for it to catch up.

I would like to second the request, if Mahmoud is willing, for an Advanced CRT lecture series or at least a good Going Deep. It looks like there was more material from that session with Mahmoud that got cut out?

All this talk about /GS has got me thinking that we are overdue for a Going Deep segment with Louis L'exception Lafreniere. How about it Charles?

@ryanb: Yes. Mahmoud's segement was in fact edited down from a longer conversation (deep(er) stuff was not cut out, however - we wanted to keep this at a medium level of complexity to make the content suitable for a wider audience and not ship a GN that's over an hour long!).

I love the idea of an Advanced CRT Going Deep or Lecture Series. This will depend on how Mahmoud feels about standing in front of a camera and talking to it (in the lecture case) or if he wants to dig in deeper in a conversational piece for GD.

What I would recommend and encourage, given the rather large scope of CRT, would be to send us what you want to know, specifically, what questions you'd like to ask Mahmoud, what advanced topics you want to learn, etc.

Let us know!

Louis no longer works on the C++ compiler team and I'm not sure what he's working on today relates to what you want us to talk to him about (he's still a native dev, of course...).

One trivial(?) thing that springs to mind when CRT is mentioned. I often find myself inside it when doing something with a native project and then there's a ton of those CRT etc files open. As a C# dude I'm used to quickly press Step In to traverse through a code I'm trying to understand. With native code I end up in CRT code or somewhere immediately with two presses of F11.

Why doesn't C++ have "Just my code" so I can Step In through my code quickly without actually ending up inside CRT or other MS code? (Maybe Shift-F11 or something to step inside if you really want to, without having to go into options to change the setting!)

With the same effort that goes to recognizing what is a CRT function (to avoid stepping in), those could be maybe optionally shown in different shade of color to tell when you can press "shift-f11" to step in.

To me ,CRT is in a kinda interesting position. I try to avoid calls into it directly in some scenario, while prefer it some others.

for example, I know I should never use CreateThread API in a normal programe because _beginthreadex does some extra work needed by CRT, but if I'm using some other frameworks I should always use higher-level stuff like AfxBeginThread or so because it might does more extra work needed by the framework itself.

another example, always use C++ new/delete, never use malloc and friends directly.

For strings, I use std::string, CString or simple TCHAR array with sprintf_s in different scenarios,

For file/file system operations, I prefer Windows API, seldom used fopen/fclose.

@MichaelPrice: Are you sure Clang supports using for templates? It could be that it didn't when we filmed the interviews, but it seems to me that Clang is making good progress in C++11 support, but is not the leader as far as I can tell (not that this is some sort of race...). Even Andrei mentioned that nobody supports template aliasing yet during each of the talks where he employed it... Either way, Clang is making some really good progress for sure.

* Great video charles.* Loved the new ide features in the IDE video.* Any chance of a vs2010/vs.next performance video/article? Without such an article my worry is that new features wont get appreciated enough as they could while people are worried about performance. But I like what I see so far.* The mscrt section was a little dull for me, but great idea to solicit feedback on what would be "not dull" on that subject (will think on that).* Charles, the "beginner" vs "advanced" topics issue is tricky. You'll want to provide both, but finding a way to measure what balance your audience wants would be good. Any ideas?* Loved hearing "the peoples view" video section. Might be an idea for windowsbuild too.* Charles, good to see the c++ renaissance momentum continuing. What really did trigger this change at MS? Can you share?* The constructor/destructor video thing is so childish! love it!! lol* @androidi, i've often wanted a quick "just my code" / "step, avoiding code that is not in my project" command.* @charles can you email anyone to ask how hard that might be to do. @anyone, maybe an ide macro could do it?* Nice to see clang mentioned and surprised, as it sounds like a competitor for ms? For Windows programming it appears to be a year or so off from being production ready at least link/runtime wise, at least from my brief experimentation with it (someone can correct me here).Good stuff.

I can't shake off the feeling that in terms of core language features of C++0x, vNext is going to be a bit of a letdown. We've had more confirmations of stuff not going to be available than stuff that's actually going to be implemented, like explicitly defaulted and deleted special member functions and non-POD initializer lists. I just hope that additions like scoped enums (a basic feature of Java/C#) will make it. It's especially painful because GCC already does all of this.

Mmm... what we really need is a lecture about COM, especially the next version

+1 for that. Who is the COM.next equivalent of Don Box?

I am definitely concerned about this COM.next business. Returning to all of COM's warts -- DLL hell, bloated registry, programming ugliness -- would be a massive step in the wrong direction. That's one thing I expect to see in the post-BUILD info dump is what exactly this COM next is and how it is not going to repeat all of the mistakes of the past.

@Charles: Oh, and you are correct, clang is definitely behind gcc in terms of C++11 implementation. However, the rate of adoption in clang has been much faster over the past 3-4 months than it ever was for gcc (of course gcc has most of it implemented now, so it has naturally slowed down. gcc had the benefit of a few extra years of development before clang really got C++03 fully implemented.

If you cannot tell, I'm a fan of clang (although I primarily work in VC++).

@Benjamin: Trying to be too cute, we are. You're right, of course.Think of the links as a way to navigate through the show and in the case of the destructor link, to shut it down (yes, you don't call destructors explicitly - which is one the cool things about them). We'll dial back the cuteness to preserve accuracy.

@Charles: Well technically (with the appropriate cajoling), you can call a destructor manually. It's just typically a really bad idea.

I've had to do it before in the case where we didn't want to link the to the CRT. Unfortunately, the CRT handles calling constructors and destructors of global statics. So, we had to hand-roll the code to call those guys ourselves.

@felix9 : I would love to see the COM vNext too :)@ryanb : The time when COM introduced was totally different, and it made sense to that way... IT industry was not so matured back then... so I am looking forward to the new COM ( if there is something like that ). COM is still serving well and there are people still doing COM development. Any of the problems you mentioned ever stopped anyone to go that way, but they yelled about it...all along that way :). C++ and library support has changed upside down since the introduction of COM. We all learned many lesson, sure microsoft must have learned more.I hope to see Don Box doing a COM vNext in "Build 8". He himself, once laughed at the C++ Devs in one of his past talk. If there is COM vNext, I am sure all the past fan base of COM and the companies that have huge code native/COM investments will jumb over it. It is one of the largely accepted programming model.

Personally I am not very hopeful about what coming next !!! provided the fact that, last time, they said "10 is the new 6". They were right in the sense that features were taken back and we are put back to the past...for example, they took away the C++/CLI intellisense, IDE typing/intellisense response way slower than VS2008. I know there has been videos and apologies about C++/CLI saying we dont have resources. I still can't digest it. There is a new version of Visual studio light switch ( Not sure what they are trying to solve, a stand alone, from the scratch VC++ IDE would have sold more than this product ), a zillion redundant API stack for .Net data access( e.g. ADO.Net, Linq to SQL, Entity FrameWork, M... ). You guys have resources for all this crap, but not for restructure the intellisense feature!!! I just dont want to continue writing my frustrations...expecting to see some good things in Build 8!!!

Lets see about the COM.vNext, I think the basics of COM are really good and play nice in Direct2D and WIC ... talking on it, One stuff I want some love is about Media Foundation, lots of sources on web still high tied to DirectShow. MF can be a nice theme for a talk about new COM and Native development (plus help better expose it to others developers)

@00:29, when you said "incredible amounts of feedback," did any of that include disdain about baring your arms? From t-shirts to fleeces is a massive shift. If it's due to the room being cold or something, ignore this, but no one should have a say in what you wear.

Mahmoud Saleh's lecture on the CRT was awesome. As a hobbyist I learned so much from his section. Thanks and keep up the good work.

@Brian: Actually, we re-shot the green-screen parts after the fact for a number of tiresome reasons. We decided to leave our jackets on for the second take for some reason. Mostly because we're cool, man. We're cool. C

[MichaelPrice]> What is up with that range-for snippet? The snippet should read:> for (object var : collection_to_loop) { }> instead of> for each (object var in collection_to_loop) { }

"for each" is an old non-Standard extension. I recommend against using it (as it's generating weird code that can't be used to mutate elements in place). Either "for (auto i = v.begin(); i != v.end(); ++i)" or "std::for_each(v.begin(), v.end(), lambda)" are superior.

Note that the C++11 range-based for-loop (which is not implemented in VC10; when it is implemented, it will not be vulnerable to the non-Standard "for each" extension's problems, because C++11 has carefully specified it) is best used as either "for (auto& e : v)" or "for (const auto& e : v)" which loops over elements in-place (and permits modification if you wish). "for (auto e : v)" will copy elements, and cannot modify elements in-place.

Charles> yes, you don't call destructors explicitly - which is one the cool things about them

This is generally true, but objects constructed via placement new must be explicitly destroyed. For example, the STL does this in std::vector. It's very advanced usage, though - many programmers can go through their whole careers without ever learning about this.

I have noticed that Microsoft does not use the STL for the existing C++ GUI APIs such as the Windows API and MFC. I hoping that will change in the future. If any current plan omits STL mechanisms for collections of data, I hope they rethink and consult with the person STL to integrate effectively.

If you are taking feedback, I'd argue for content that is more technically advanced. For example, with respect to CRT, I would spend much less time on trivial things like "the CRT contains functions your application can call, and these functions in turn call Win32" (one minute of quick recap is all you need, we aren't exactly new to this C++ thing), and much more time on non-trivial things like:

* the CRT features that the compiler uses,* what happens when two versions of the CRT (say, dynamic and static) load into the same process (why this is bad and how to tell that this happened),* how the patching is or should be done (version numbers, side-by-side execution, policies looking forward, etc),* what tests do the CRT devs use (actual examples),* was the addition of _s functions a good or bad idea in retrospect and how many have adopted these,* is there anything we might want to know as regards the interaction between CRT and STL, etc.

@David: Thank you for the feedback! We will try to ensure we have content that is suited for advanced users in addition to less advanced users. It's challenging, but doable (we want to not ship hour long episodes...). BTW, Mahmoud will be doing a C9 Lecture series on CRT, so that's where the advanced CRT material will materialize.

[MichaelPrice]> What is up with that range-for snippet? The snippet should read:> for (object var : collection_to_loop) { }> instead of> for each (object var in collection_to_loop) { }

"for each" is an old non-Standard extension. I recommend against using it (as it's generating weird code that can't be used to mutate elements in place). Either "for (auto i = v.begin(); i != v.end(); ++i)" or "std::for_each(v.begin(), v.end(), lambda)" are superior.

Note that the C++11 range-based for-loop (which is not implemented in VC10; when it is implemented, it will not be vulnerable to the non-Standard "for each" extension's problems, because C++11 has carefully specified it) is best used as either "for (auto& e : v)" or "for (const auto& e : v)" which loops over elements in-place (and permits modification if you wish). "for (auto e : v)" will copy elements, and cannot modify elements in-place.

I wonder if there will be room in the C++ snippets to generate the byref and byconstref patterns. Picking a "default" pattern could be a very risky move...

However, if I had to vote for a default, it would be for (const object & var : collection_to_loop) as it is the "safest" pattern.

Also, I agree about std::for_each... Let the library do the hard thinking (and possibly optimization) for you.

Just gotta say, Charles. Your are a bit of a brute and that is much appreciated. Its exactly what a show like this needs. A guy who shots from the hip, who isn't afraid to ask silly questions, and does not mind to much too about political correctness. I get the feeling that Herb isn't always to keen on some of your vague or open ended questions, but that's the best kind. It makes for the most interesting answers. "The Q and A at "C++ and beyond" for instance was very good like that. When you assked Alexandrescu "Why D?". A more careful or less bold man would have avoided the sensitive topic ... and we would have missed out on such an interesting discussion. Keep up the good work and don't change a thing.

@petke: Thanks It's just the way I play this game: what comes to mind comes out of my mouth (and sometimes to the chagrin of viewers, but mostly to the benefit of the conversation). Appreciate the kind words.

I appreciate the types of features you're adding to the IDE, but please, please, please focus on performance first. VS 2010 is a huge step backwards in performance for basic editing. These must be fixed before you start putting more stress on the editor and IntelliSense.

I would also love to see more on the CRT. But one question I would like to see answered, is why do I need to 'care' about it? Are there certain scenarios where understanding what it does matters? Thanks!!!

@David: Thank you for the feedback! We will try to ensure we have content that is suited for advanced users in addition to less advanced users. It's challenging, but doable (we want to not ship hour long episodes...). BTW, Mahmoud will be doing a C9 Lecture series on CRT, so that's where the advanced CRT material will materialize.

Remove this comment

Remove this thread

Comments Closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation,
please create a new thread in our Forums, or
Contact Us and let us know.