The Visual C++ Weekly Vol. 1 Issue 13 (Mar 26, 2011)

The Visual C++ Weekly Vol. 1 Issue 13 (Mar 26, 2011)

  • Comments 13

Read in this issue:

  • [Herb Sutter] C++0x: We Have Final Draft International Standard!
  • [Parallel Patterns Library] Building Responsive GUI Applications with PPL Tasks
  • [C++ MVP Giovanni Dicanio] Text-to-Speech in C++
  • [Danny Kalev] Detecting Memory Leaks to Improve Performance
  • [C++ MVP Giovanni Dicanio] Checked Iterators
  • [Windows Development] Using Services
  • @Diegum, Are you just "Binging" or "Googling" for some C++ articles and pasting them here ? Looks like that is the case when we read your recent VC++ Weekly Issues. The memory detection technique presented in the article is nothing new to anyone. When you click next -> next of the page, you find an assault on VC++ 8.0 compiler by the author. FYI,  www.informit.com/.../content.aspx .

    Why don't you be more serious with your compilation of articles ?

  • "The memory detection technique presented in the article is nothing new to anyone."

    That is a bit presumptuous don't you think?

  • @Chris:

    "That is a bit presumptuous don't you think?"

    Did you read the "article"? The advise is to avoid memory leaks by tracking down all raw pointers as well as all calls to new and new[] and try to replace raw pointers with smart pointers or some kind of wrapper classes like std::string, that take care of their memory by themselves. No kidding. What's next? An article on the basics of integer math? Sigh.

  • @Chris, Well I might sound presumptuous, but RAII technique has been posted more than 1 time in this blog itself. Remember the previous post on exceptions ? Even that demonstrates the technique. On top of that, the author of the original article does not even tell us how to use unique_ptr. He just informs us about it.

  • @Diegum, not intended to say anything negative just for the sake of it. In fact, the other links in the post are good.

  • Thanks, @Jagannath!!

    We try to offer a combo composed by MS generated input complemented with non-MS stuff (this InformIT article belonging to the latter); advanced articles for experienced C++ developers complemented with some lighter info for those still needing some progress (again, this InformIT piece belonging there).

    We do also try to balance between articles, news, downloadable samples and/or toolkits.

    Despite the technique sounds more than obvious today for pro devs, I wouldn’t bet that everybody knows it/applies it. Probably those professional developers working with C++ for a longtime do. However, C++ is being sought by managed code devs looking back for the power and performance C++ delivers (they learned C++ at school but haven’t used for about ten years now). They think (some told me) that C++ is all about raw pointers, memory leaks, the new operator, etc. When I tell them that those problems have been solved several years ago; that patterns like RAII -which they don't know at all- are mainstream today, they stay half-skeptic / half-hopeful about modern C++.

    The reason we complement the weekly with those pieces, is to help demystify C++ drawbacks (by those who aren’t frequent C++ developers). So that’s about how Kalev’s piece got a slot in this issue. Btw, the article you mentioned about VC++ 8 has little to do in this plot: Kalev’s articles are linked in a sort of ring so if you are in his latest and click “Next” you go back to the beginning; just check the dates.

  • @Diegum, I must tell you. The above response is 100 % true. Not to mention it applies to the place I work . In our team, the management and other folks who are tech leads firmly believe that C++ code = memory leaks. So, the direction is towards Java in our team. I did propose a Smart pointer, but for some reason the full implementation never made to production. Only stripped version of it was implemented which is so tedious to use, that no one is using it all.

    Thanks

    Jagannath.

  • So did you finally see that the article wasn't meant for you after all?

  • @Chris, :-) I did not like " Detecting Memory Leaks to Improve Performance". I don't have issue with the other items in the post. OK. let us think for a moment that we never heard of smart pointers or RAII techinique. Now, can you show me where in the article it was mentioned how to use them ?

    "For example, if your app uses char*, replace it with std::string. Similarly, if you have CWnd*, replace that raw pointer with unique_ptr<CWnd>. "

    Coming to unique_ptr<CWind>, how do I use it ?

    unique_ptr<CWind> ptr(new CWind());

    How do I access the members of ptr ? Through  "." operator ? How would I know that it overloads -> operator?

    You want me to look at the documentation of unique_ptr ? What's is the purpose of such article then ?

    Ok, there is a link for unique_ptr in the article. Does it show how to use it ? No. It shows the differences between auto_ptr and unique_ptr. But not how to use it.

    If you still believe that I thought this article is not meant for me, then I can't help it. I was just saying the article did not provide as much information as one would like about smart pointers. It was like passing reference.

    Coming to "replace char* with std::string", I am not sure if one can blindly follow it. There could be cases where char* might be more performant than std::string.

  • I agree with @Diegum and others - proficient programmers are and will always be the minority. There are still lots of guys who are stuck with their C++ knowledge and habits in 90' and if we want to see progress with regards to general C++ understanding and appreciation then we have to keep educating them with things "obvious" to experts, like RAII.

  • However, I also think that the quality of the articles linked could sometimes be verified more thoroughly if the Weekly is to be a valuable help for learners of modern C++. ;-)

  • Thank you guys. You are right in your comments and we'll take your thoughts as valuable input to improve our value proposition. Keep speaking up.

  • I agree the unique_ptr article could've been more helpful.  IMO it does point people in the right direction who may not have considered using it.

Page 1 of 1 (13 items)