<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Christophe Pichaud on Microsoft Technologies</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/christophep/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/christophep/feed.xml</link>
    <description>Native stuf. The C++ Renaissance. The world is built on C++ !</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:20:28 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>The World Is Built On C/C++</title>
      <link>https://docs.microsoft.com/archive/blogs/christophep/the-world-is-built-on-cc</link>
      <pubDate>Wed, 20 Sep 2017 17:56:52 GMT</pubDate>
      <dc:creator><![CDATA[Christophe Pichaud [MVP]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christophep/?p=236</guid>
      <description><![CDATA[Just facts...

]]></description>
      <content:encoded><![CDATA[Just facts...

<img src="https://msdnshared.blob.core.windows.net/media/2017/09/TheWorldIsBuiltOnCPP.png" alt="" width="1920" height="1080" class="alignnone size-full wp-image-245" />]]></content:encoded>
    </item>
    <item>
      <title>C++ Myths and Reality</title>
      <link>https://docs.microsoft.com/archive/blogs/christophep/c-myths-and-reality</link>
      <pubDate>Tue, 19 Sep 2017 16:15:21 GMT</pubDate>
      <dc:creator><![CDATA[Christophe Pichaud [MVP]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christophep/?p=226</guid>
      <description><![CDATA[The world is built on C++: Windows and its 3400 dlls, Explorer app, MS Paint, your browsers (Chrome,...]]></description>
      <content:encoded><![CDATA[The world is built on C++: Windows and its 3400 dlls, Explorer app, MS Paint, your browsers (Chrome, Edge, IE, Firefox), your multimedia player, Office suite (Word, Excel, Outlook, etc), Notepad++, SysInternals Suite Tools, etc.

Here is a picture I wrote about C++ myths and reality ; it's funny. Everybody can catch something.

<img src="https://msdnshared.blob.core.windows.net/media/2017/09/myths_and_reality.png" alt="" width="1920" height="1080" class="alignnone size-full wp-image-235" />]]></content:encoded>
    </item>
    <item>
      <title>The technologies I use on the field - C/C++ Missions</title>
      <link>https://docs.microsoft.com/archive/blogs/christophep/the-technologies-i-use-on-the-field-cc-missions</link>
      <pubDate>Tue, 15 Aug 2017 12:22:20 GMT</pubDate>
      <dc:creator><![CDATA[Christophe Pichaud [MVP]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christophep/?p=215</guid>
      <description><![CDATA[When I have to handle a customer with native applications, the context is completely different from...]]></description>
      <content:encoded><![CDATA[When I have to handle a customer with native applications, the context is completely different from managed .NET missions.

First, a C/C++ compiler of 10 years ago still works. So what ? You can work with older version of Visual Studio or, I have one customer like, with Visual C++ 6.0 because it was a huge success. For my VC6 customer, I can run the software only in the context of the customer office because it relies on the server-side web application that handles 1500 pages of JSP. An more, at 17:00, the system is closed for maintenance system. In this context, you feel like Indiana Jones in the jungle... :)

The always-good application to have in this scenario is WinDBG. You can attach to the process and try to find first chance exception. The other option is to use the WinDBG API to write a pseudo debugger. In fact, you provides a process ID and you attach in soft mode. The program is still running but you register to be notified of any exception and you can see the stack walk, generate a mini-dump and other useful stuff.

But, when you deal with thousands lines of code, if you have a trace/log file, it may becomes your best friend. First, in the code, you have to learn the algorythm speed road. Where the source code begins and where it goes with API system calls, thir-party libraries and CRT/STL calls. if fact, it's a memory problem. Can you brain remember all those functions name ? It's the clue to the success. If you have a good memory, it can be your lawyer.

In large applications, you may have a switch for enabling debug mode with trace files. Advice: use it ! When developers build a complex system, there are logs/traces. It occurs 90% of time.

In the C++ world, the standard ISO C++ has evolved on C++11, C++14 and now C++17. It requires new compilers. But it's hard to move from one compiler to another, specially in the Microsoft C++ world. Sometimes, includes/libs are set on solutions, sometimes it is set on projects, sometimes it's a pain. But, Since VS2013/2015/2017, it's stable. I agree, you have to recompile boost libs or any others third party libs. But your new compiler opens the way to C++11 (witch is the biggest enhancements). There are a lot of features that are available in C++11 that can make your code more sexy and readable.]]></content:encoded>
    </item>
    <item>
      <title>The technologies I use on the field - .NET Missions</title>
      <link>https://docs.microsoft.com/archive/blogs/christophep/the-technologies-i-use-on-the-field</link>
      <pubDate>Sun, 06 Aug 2017 08:23:08 GMT</pubDate>
      <dc:creator><![CDATA[Christophe Pichaud [MVP]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christophep/?p=205</guid>
      <description><![CDATA[On the field, customers have a lot of time a lot of technologies for building their IT system....]]></description>
      <content:encoded><![CDATA[On the field, customers have a lot of time a lot of technologies for building their IT system. First, they rely on .NET Framework and C#. Then, we split into two categories, either Web or classic Windows development. But, the most important next is the data access choice. Either Entity Framework, Transact-SQL, raw SQL, dapper or Enterprise Library. Backend Database is SQL Server in 90%.

On the backend, IIS is very used because of the facility of doing web services like WCF or Web API.

When you understand the architecture of the software, you make a deep dive into the source code. Each customer has a technique to organize its code. I appreciate when there is a single solution but it depends. In the code, we often see interfaces and DI stuff like Unity. Sometimes, there is the popular Framework Entreprise Library. LINQ is heavy used. For WPF projects, you can see PRISM also. For Web apps, a lot of JavaScript libs can be used.

To master all these technologies, it takes time to be an expert ; each of them can take several weeks to be discovered. For example, WCF can be easy to code but the configuration file both on client and server can make you crazy.

Once you have discovered the source code, take a look at the Source Control Management system. It can be TFS, git, svn, ClearCase... Check the branching strategy of the customer.

There are no magic rules to bring your customer to the top. There are best practices for C#, SQL, DI, oriented object programming, TFS branching and merging, etc.

The more customers you see, more your experience is valuable, you eat multiple way of doing software.

The next step your customer is asking is sometimes performance enhancements or scalability. And in the job is difficult. There are a lot of cases where the rules "Simple is beautiful" solve the problem. But sometimes, it's Linq requests that are faulty, most of the time related with Entity Framework. Be aware to not get all data on the client/server side without exclusion criteria. Rely on trusted stuff, use the server and make sever processing when you can rather of using the web server...

I am on the field more than 20 years and I am always fascinated of what I see on customers's site.

&nbsp;

&nbsp;

&nbsp;

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Old-school debugging with traces</title>
      <link>https://docs.microsoft.com/archive/blogs/christophep/old-school-debugging-with-traces</link>
      <pubDate>Thu, 20 Jul 2017 04:44:44 GMT</pubDate>
      <dc:creator><![CDATA[Christophe Pichaud [MVP]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christophep/?p=196</guid>
      <description><![CDATA[On the field, a customer has a big Windows application made with C/C++, Windows API and MFC. The...]]></description>
      <content:encoded><![CDATA[On the field, a customer has a big Windows application made with C/C++, Windows API and MFC. The application is used by 16.000 users. This app presents multiple windows on the same screens like MDI child browser windows, Win32 app and more. The app reorganizes windows in perspectives.

The problem, is that, sometimes, the windows are re-arranged and the panels contain some empty windows and the app runs in a infinite loop... There is a problem on the display. There are multiples threads and a lot of logic with Windows messaging subsystem. It took me hours to find where there can exists a failure in the code and an infinite loop. It put traces on some methods... There was some zones in the code that could enter the app in infinite loop so I was fighting in the code at multiple places.

There was already a trace mode so that entering in each method was traced with parameters. The problem is that when the code is huge, it does not help so much... So I put my level of traces and I start learning the method calls by myself. It was hard because the internal data structures are mixed between Win32 messages, custom messages and business code. There is little spaguetti stuff !

After some failed attempts to analyze the code, I was stucked on a method called GetView() wich , when it begins to hang, return NULL... And displaying NULL a an MDI child window is not very acceptable... It works all the time but, under a special business scenario, it fails. I was sure there was an exception code somewhere where I could see and system exception. The code contains SEH (structured exception handling) and there was traces on __except(). I reactivated the original tracing system and saw exception messages.... Multiples exception messages. And my GetView() function was called immediatly after the exception so it could explain that I get a NULL. It fails so some parts of the code are not executed and the flow of windows messages produce a hang.

After some days of learning the methods names and the program flow, I decided to rely on the existing trace system. After several scenarios, I have a business case that produces a app hang. Same actions and app hangs every time. A good candidate... The result is clear : the cache subsystem hangs and fails to recover cache object. It explains why my GetVies() returns NULL...

The devil is in the details. I decided to remove the thread of the cache subsystem. It stores Windows and kill them after 5 minutes of inactivity. Now there are no more problems.

To finish the job, I just need to fix the cache subsystem but, we can run without it so... It's the opinion of the customer to see if we continue investigations whether or not.

So the old-school advice is: <strong>always trace your exception handlers</strong>.]]></content:encoded>
    </item>
    <item>
      <title>ISO C++ last status</title>
      <link>https://docs.microsoft.com/archive/blogs/christophep/iso-c-last-status</link>
      <pubDate>Sat, 15 Jul 2017 17:17:18 GMT</pubDate>
      <dc:creator><![CDATA[Christophe Pichaud [MVP]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christophep/?p=185</guid>
      <description><![CDATA[This poster shows the status of the ISO C++ standard:



&nbsp;

To find more, just go at Herb...]]></description>
      <content:encoded><![CDATA[This poster shows the status of the ISO C++ standard:

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/wg21-timeline-2017-07b.png" alt="" width="1937" height="1427" class="alignnone size-full wp-image-195" />

&nbsp;

To find more, just go at <a href="https://herbsutter.com/2017/07/15/trip-report-summer-iso-c-standards-meeting-toronto/">Herb Sutter blog</a>.

Now its' time to see how many features the Visual C++ Team had implemented.

&nbsp;]]></content:encoded>
    </item>
    <item>
      <title>Returning JSON data from a REST Web Server</title>
      <link>https://docs.microsoft.com/archive/blogs/christophep/returning-json-data-from-a-rest-web-server</link>
      <pubDate>Sun, 02 Jul 2017 09:43:35 GMT</pubDate>
      <dc:creator><![CDATA[Christophe Pichaud [MVP]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christophep/?p=125</guid>
      <description><![CDATA[To return data on a rest web server, you have to provide JSON data file format. To illustrate the...]]></description>
      <content:encoded><![CDATA[To return data on a rest web server, you have to provide JSON data file format. To illustrate the sample (see <a href="https://blogs.msdn.microsoft.com/christophep/2017/07/01/write-your-own-rest-web-server-using-c-using-cpp-rest-sdk-casablanca/">my previous post)</a>, I have decided to return a simple structure:
<ul>
 	<li>std::vector&lt;People&gt; peoples</li>
 	<li>utility::string_t job</li>
</ul>
The People structure contains just:
<ul>
 	<li>utility::string_t name</li>
 	<li>double age</li>
</ul>
I have made a little modification on my PUT handler to return data:

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/rest_5.png" alt="" width="707" height="535" class="alignnone size-full wp-image-135" />

The last piece of code is the code that produce the AsJSON() function call.

For each structure, there is a AsJSON and a FromJSON

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/rest_6.png" alt="" width="519" height="357" class="alignnone size-full wp-image-145" />

&nbsp;

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/rest_11.png" alt="" width="750" height="770" class="alignnone size-full wp-image-167" />

&nbsp;

You can see the result on the console output of the server. On the client side, ask the method called 'leave'.

<img src="https://msdnshared.blob.core.windows.net/media/2017/07/rest_10.png" alt="" width="979" height="512" class="alignnone size-full wp-image-166" />

You can download the full <a href="http://www.windowscpp.com/Projects/MySolutionCppRest.zip">C++ solution here</a>. Only C++ <a href="http://www.windowscpp.com/Projects/MyClient.zip">client</a> or <a href="http://www.windowscpp.com/Projects/MyServer.zip">server</a>.]]></content:encoded>
    </item>
    <item>
      <title>Write your own REST Web Server using C++ using CPP REST SDK (casablanca)</title>
      <link>https://docs.microsoft.com/archive/blogs/christophep/write-your-own-rest-web-server-using-c-using-cpp-rest-sdk-casablanca</link>
      <pubDate>Sat, 01 Jul 2017 10:23:01 GMT</pubDate>
      <dc:creator><![CDATA[Christophe Pichaud [MVP]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christophep/?p=75</guid>
      <description><![CDATA[To start, you have to download the C++ REST SDK from Github. It enables to build the library. Just...]]></description>
      <content:encoded><![CDATA[To start, you have to download the <a href="https://github.com/Microsoft/cpprestsdk">C++ REST SDK from Github</a>. It enables to build the library. Just open the sln file in the root folder, <span>restore nuget packages and </span> and that's all. Build.

The compilation results in a 4,9 MB file. Now you can build your own web server. You just have to include some headers.
<ul>
 	<li>#include "cpprest/json.h"</li>
 	<li>#include "cpprest/http_listener.h"</li>
 	<li>#include "cpprest/uri.h"</li>
 	<li>#include "cpprest/asyncrt_utils.h"</li>
</ul>
The namespaces to use are:
<ul>
 	<li>using namespace web;</li>
 	<li>using namespace http;</li>
 	<li>using namespace utility;</li>
 	<li>using namespace http::experimental::listener;</li>
</ul>
The first thing is to declare is a <strong>uri_builder</strong> object. In my case, this is "http://localhost:34568/MyServer/Action/".  Now we can create a <strong>MyServer</strong> class that exposes end points.

<img width="521" height="429" class="alignnone size-full wp-image-115" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/07/rest_4.png" />

The class contains an <strong>http_listener</strong> element.

<img width="803" height="705" class="alignnone size-full wp-image-86" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/07/rest_2.png" />

Here the implementation of the server. First, in the constructor, we expose all the end-points. In this implementation, the end-points return OK. But you can return JSON data, it is supported by the C++ REST SDK. The missing part is the wmain who instanciate the MyServer class...

<img width="808" height="840" class="alignnone size-full wp-image-96" alt="" src="https://msdnshared.blob.core.windows.net/media/2017/07/rest_3.png" />

As you can see, it is very simple. One handler for each verb and you are are on line.

The source code is <a href="http://www.windowscpp.com/Projects/MyServer.zip">available here</a>.]]></content:encoded>
    </item>
    <item>
      <title>Why C++ in 2017 ?</title>
      <link>https://docs.microsoft.com/archive/blogs/christophep/why-c-in-2017</link>
      <pubDate>Mon, 26 Jun 2017 21:19:01 GMT</pubDate>
      <dc:creator><![CDATA[Christophe Pichaud [MVP]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christophep/?p=65</guid>
      <description><![CDATA[What are the advantages of making software with C/C++ in 2017 ? The question is simple. But the...]]></description>
      <content:encoded><![CDATA[What are the advantages of making software with C/C++ in 2017 ? The question is simple. But the response is extraordinary powerful. Let me explain...

If you are on the server, you want performance... You don't want to distribute a huge framework and cross too many layers. If you have the socket handler, you make the process and you use the socket back. It's fast, it's powerful. Look at the <a href="https://github.com/Microsoft/cpprestsdk">casablanca library</a>, it is built for that. You have REST support and it's build to be easy to use it. Looking for an existing HTTP server ? Just explore the source code of NGINX. Another ? Look at lighttpd, it's small, it is fast. On the server, you achieve more than any other language and your are close to the CPU, very close if you use optimized code or low level processor extensions API.

On the Linux land, everything (in my opinion 98%) is done using C and C++. You can download the source code of your favorites applications. It's a fabulous way to discover all the magic of theses softwares.

If you are on the mobile, you need to manage the battery, the memory and manage resources in general. Here, the king is C/C++. You allocate the number of bytes you need, you create threads to gain extra power and you are responsible to free resources you use. If you need to process data like image or video or music, the signal stuff must be written in native code and this is the only solution.

Let's talk about databases or database engines files based like MySQL or Codebase, you have a C source code base. You build it on your platform and you can gain access to this marvelous engines. You build upon your operating system, there is nothing closest than that. Next stop is registers and code optimizations. Your compiler can handle it alone, it's just a matter of compiler flags.

On the desktop land, it's simple: can you run your application on Windows XP, Vista, Seven, Windows 8.x and Windows 10 ? Some of yours would say "may be, may be not". In C++, you can. No framework to distribute. Just the vcredist.exe magic stuff. 10 MB.

C++ applications means superiority in CPU usage, memory management and lower battery utilization : it's a fact. It's part of the deal. It runs fast by default.

In the C++ world we don't create a class witch contains 5 methods and 2 fields like in Java or C#. We do more. A lot more. Our class are consequent and take a lot of stuff inside because it is interesting to have a project with 10 files of 100 KB rather than 300 files of 3 KB organized with fuzzy concepts. We do OOP better. It's more compact, it's real, it just works.

In C++, we have the feature of the templates. It's superior to C# generic and it's used differently. The STL is the Standard Template Library, it's made with templates. The std::string is made with it, the vector&lt;T&gt; is made with it, it's magic and efficient. We support multi-inheritance. We don't create interfaces when it's not necessary. C++ coding is the superior form of coding for OOP compared to productive language like Java or C#.]]></content:encoded>
    </item>
    <item>
      <title>My Favorites C++ Books</title>
      <link>https://docs.microsoft.com/archive/blogs/christophep/my-favorites-c-books</link>
      <pubDate>Fri, 16 Jun 2017 18:16:45 GMT</pubDate>
      <dc:creator><![CDATA[Christophe Pichaud [MVP]]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/christophep/?p=45</guid>
      <description><![CDATA[There are various books about C++. The reference manuals and the optimizations ones. For example,...]]></description>
      <content:encoded><![CDATA[There are various books about C++. The reference manuals and the optimizations ones. For example, Addison Wesley has a serie called "C++ In-Depth - Bjarne Stroustrup" also called the red books. Look at this titles:
<ul>
 	<li><i>Accelerated </i>C++: <i>Practical Programming by Example, </i>Andrew Koenig
and Barbara E. Moo</li>
 	<li><em>Applied C++: Practical Techniques for Building Better Software</em>, Philip Romanik and Amy Muntz</li>
 	<li><em>The Boost Graph Library: User Guide and Reference Manual</em>, Jeremy G. Siek, Lie-Quan Lee, and Andrew Lumsdaine</li>
 	<li><em>C++ Network Programming, Volume 1: Mastering Complexity Using ACE and Patterns</em>, Douglas C. Schmidt and Stephen D. Huston</li>
 	<li><em>C++ Network Programming, Volume 2: Systematic Reuse with ACE and Frameworks</em>, Douglas C. Schmidt and Stephen D. Huston</li>
 	<li><em>C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond</em>, David Abrahams, Aleksey Gurtovoy</li>
 	<li><i>Essential </i><span>C++, Stanley B. Lippman</span></li>
 	<li><em>Exceptional C++ Style 40 New Engineering Puzzles, Programming Problems, and Solutions</em>, Herb Sutter</li>
 	<li><i>Exceptional </i>C++; <i>47 Engineering Puzzles, Programming Problems,</i>
<i>and Solutions, </i>Herb Sutter</li>
 	<li><i>Modern </i>C++ <i>Design: Applied Generic Programming and Design Patterns,</i>
Andrei Alexandrescu</li>
 	<li><em>More Exceptional C++: 40 New Engineering Puzzles, Programming Problems, and Solutions</em>, Herb Sutter</li>
</ul>
Not in the serie:
<ul>
 	<li><em>Effective C++ Third Edition, 55 Specific Ways to Improve Your Programs and Designs</em>, Scott Meyers</li>
</ul>
The book of the language is:
<ul>
 	<li><em>The C++ programming language, Fourth edition</em>, Bjarne Stroustrup</li>
</ul>
The books to understand rapidly the new features of C++11 is:
<ul>
 	<li><em>A Tour of C++</em>, Bjarne Stroustrup</li>
 	<li><em>C++ Primer, Fifth Edition</em>, Stanley B. Lippman, JosÃ©e Lajoie, Barbara E. Moo</li>
</ul>
The book to understand the compilers is:
<ul>
 	<li><em>Inside the C++ Object Model</em>, Stanley B. Lippman</li>
</ul>
The book to learn the STL:
<ul>
 	<li><em>The C++ standard library : a tutorial and reference</em>, 2nd Edition, Nicolai M. Josuttis</li>
</ul>]]></content:encoded>
    </item>
  </channel>
</rss>