<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.microsoft.co.il/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>Asaf Shelly</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/</link><description>Parallel Computing &amp;amp; Cloud</description><dc:language>en</dc:language><generator>CommunityServer 2007.1 (Build: 20917.1142)</generator><item><title>When to use the IsBadXxxPtr Win32 API</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2010/01/17/when-to-use-the-isbadxxxptr-win32-api.aspx</link><pubDate>Sun, 17 Jan 2010 14:56:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:500830</guid><dc:creator>AsafShelly</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=500830</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=500830</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2010/01/17/when-to-use-the-isbadxxxptr-win32-api.aspx#comments</comments><description>&lt;p&gt;This post is a follow-up for two previous posts. The first is my own called &lt;a class="" href="http://beta.blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/27/verifying-c-buffers.aspx" target="_blank"&gt;&lt;font color="#800080"&gt;Verifying C++ Buffers&lt;/font&gt;&lt;/a&gt; which was replied&amp;nbsp;with a second post by Sasha titled &lt;a class="" href="http://blogs.microsoft.co.il/blogs/sasha/archive/2010/01/15/isbadxxxptr-is-really-harmful-please-don-t-use-these-functions.aspx"&gt;&lt;font color="#800080"&gt;IsBadXxxPtr Is Really Harmful – Please Don’t Use These Functions&lt;/font&gt;&lt;/a&gt;. The first post mentioned the advantages of using IsBadXxxPtr API over verifying pointers by using ASSERT (or comparing to zero). The second post mentioned the problems with this set of API in a multi-threaded application. Just to clarify my comment here is not personal and Sasha and I are having an academic discussion which will benefit us all.&lt;/p&gt;
&lt;p&gt;Let me start by saying that the information provided in the first post is valid and works well with a single threaded application. As Sasha explained the API does not consider parallel operations. This is noted on the MSDN page for the API and&amp;nbsp;at the end of my first post. The reason I did not elaborate more on this is because it is not such a clear cut. Sasha has explained&amp;nbsp;reasons not to use the API in a parallel environment and I will try to&amp;nbsp;argue the reasons for using this API in a parallel environment.&lt;/p&gt;
&lt;p&gt;Here are the scenarios I will be examining:&lt;/p&gt;
&lt;p&gt;Scenario A: The pointer value is zero / NULL. This is usually because we initialized the pointer correctly or because a structure was never initialized in debug compilation&lt;/p&gt;
&lt;p&gt;Scenario B: The pointer value is above zero but is very close to zero, for example address 1, 23, or 32K. This is usually because we are accessing a member of a struct which address is NULL. The address of the struct is zero so the address of a member is&amp;nbsp;its offset from zero. Another possible reason for this scenario is an item in an array when the array is NULL.&lt;/p&gt;
&lt;p&gt;Scenario C: A random number is used for the pointer. This is because we are using an uninitialized memory (in the stack for example), or because of buffer over-run / buffer under-run which caused memory corruption in the storage of the pointer.&lt;/p&gt;
&lt;p&gt;Scenario D: The pointer is initialized correctly but the buffer was already deleted and therefore the pointer is pointing at an invalid buffer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ASSERT or IsBadXxxPtr?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;When we use ASSERT or test the buffer whether it is NULL or not we are actually testing to see whether or not we are using a buffer that was initialized to zero. This only works if the&amp;nbsp;pointer was correctly initialized. Some functions would not expect NULL, such as printf( )&amp;nbsp;or puts( ), while other functions may consider this as a valid value for example the UserContext parameter when creating a thread - if it is NULL then there is no context.&lt;/p&gt;
&lt;p&gt;Going over the scenarios comparing the pointer to zero or using ASSERT: Scenario A works fine. Scenario B will not find the bug and your function will try to access the buffer. Scenario C: same as B, and it is also the same for Scenario D.&lt;/p&gt;
&lt;p&gt;Testing the same scenarios with IsBadXxxPtr: Scenario A works fine. Same for Scenario B. These two scenarios happen even if pointers are correctly initialized! Scenario C will work if the random value happens to fall on a Heap page out of the 4GB virtual space (pages are usually 4K for 32 bit systems). Scenario D will work if the buffer was the last on that page. When the last page on the buffer is deleted the page is marked as inaccessible.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;When do we see problems with multi-threading?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Unmapping a page in a second thread: This means that&amp;nbsp;one thread&amp;nbsp;deleted an object while another thread was working on&amp;nbsp;it. This is because you&amp;nbsp;shared the resource (buffer) but forgot to lock or used the locks incorrectly. ASSERT will never detect that&amp;nbsp;because the pointer has an address&amp;nbsp;that it more than zero and ASSERT has no way of telling if the page is valid.&lt;/p&gt;
&lt;p&gt;IsBadWritePtr corruption of memory: is because a resource was shared but the thread used the lock only after calling IsBadWritePtr because the programmer did not know that IsBadWritePtr is accessing the memory. This is a problem and you should know that calling IsBadWritePtr will modify memory even though the name suggests that it is only testing a pointer.&lt;/p&gt;
&lt;p&gt;Guard Pages are used in an internal implementation which does not expect IsBadXxxPtr API to access these pages. This may happen for example when a thread is&amp;nbsp;sharing a buffer which is located on its own stack, which is a terrible bug. Such a bug will randomly damage Guard Pages, or corrupt the other thread&amp;#39;s stack, or cause the other thread to access bad memory (by overwriting pointers located in the other thread&amp;#39;s stack). I can&amp;#39;t tell you which is better, but if your thread found an invalid pointer of an internal buffer then something is very wrong and you can&amp;#39;t find this using ASSERT.&lt;/p&gt;
&lt;p&gt;There is a long and painful argument whether exceptions are good or bad. In a multithreading environment I consider exceptions to be always bad because an exception is a bursting&amp;nbsp;Event that will be initiated even when you are in some execution flow. Multi-threading environments are all about synchronizing execution and flow control. The possibility of a flow breaking because of an event is really bad. It is a system wide problem if a thread is using a Semaphore object and then stopping in the middle of work because of an exception because some other thread did something wrong 5 minutes ago. It is simpler to verify pointers than to check all possible exceptions. An exception is something special, not a return value. When exceptions became return values functions started swallowing them and hide the real problems.&lt;/p&gt;
&lt;p&gt;For conclusion, with all problems that come with using the IsBadXxxPtr Win32 API, I would still prefer using this API set than using ASSERT which allows bugs to happen. If&amp;nbsp;the code has no bugs then IsBadXxxPtr causes no damage. If your code has bugs then using IsBadXxxPtr will solve more problems than cause them, unless you are going to use this to hide the problems.&lt;/p&gt;
&lt;p&gt;If my application supports plug-ins then I would prefer to verify interface buffers than to let buffers from an external module damage my application.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=500830" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/Parallel+Computing/default.aspx">Parallel Computing</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/multiprocessing/default.aspx">multiprocessing</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/multicore/default.aspx">multicore</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/http_3A002F002F00_AsyncOp.com/default.aspx">http://AsyncOp.com</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/WDK/default.aspx">WDK</category></item><item><title>Visual C++ Compiler ERROR C2016</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/29/visual-c-compiler-error-c2016.aspx</link><pubDate>Tue, 29 Dec 2009 15:58:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:478469</guid><dc:creator>AsafShelly</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=478469</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=478469</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/29/visual-c-compiler-error-c2016.aspx#comments</comments><description>&lt;p&gt;Compiling a C file with Visual Studio 2008 compiler I got this error:&lt;/p&gt;
&lt;p&gt;&amp;quot;error C2016: C requires that a struct or union has at least one member&amp;quot;&lt;/p&gt;
&lt;p&gt;I am writing this post because it is not documented, and &lt;a class="" href="http://msdn.microsoft.com/en-us/library/aa229170(VS.60).aspx" target="_blank"&gt;C2016 on MSDN&lt;/a&gt;&amp;nbsp;is defined as &amp;quot;A newline character was found before the closing single quotation mark of a character constant&amp;quot;. Either it is not well documented or I don&amp;#39;t know where to look for it. Whatever the reason I can only guess that someone else will find the same problem.&lt;/p&gt;
&lt;p&gt;This is the cause:&lt;/p&gt;
&lt;p&gt;&lt;font face="courier new,courier"&gt;struct&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; int&amp;nbsp;&amp;nbsp;&amp;nbsp; u8Type;&lt;br /&gt;&amp;nbsp;&amp;nbsp; int&amp;nbsp;&amp;nbsp;&amp;nbsp; u8LenExtended;&lt;br /&gt;&amp;nbsp;&amp;nbsp; int&amp;nbsp;&amp;nbsp; u16Length;&lt;br /&gt;} Base_Request;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="courier new,courier"&gt;struct Request_Ex&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; Base_Request Request;&lt;br /&gt;&amp;nbsp;&amp;nbsp; int Address;&lt;br /&gt;&amp;nbsp;&amp;nbsp; int Length;&lt;br /&gt;};&lt;br /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;This is the fix:&lt;/p&gt;
&lt;p&gt;&lt;font face="courier new,courier"&gt;&lt;font color="#0000ff"&gt;typedef&lt;/font&gt; struct&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; int&amp;nbsp;&amp;nbsp;&amp;nbsp; u8Type;&lt;br /&gt;&amp;nbsp;&amp;nbsp; int&amp;nbsp;&amp;nbsp;&amp;nbsp; u8LenExtended;&lt;br /&gt;&amp;nbsp;&amp;nbsp; int&amp;nbsp;&amp;nbsp; u16Length;&lt;br /&gt;} Base_Request;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="courier new,courier"&gt;struct Request_Ex&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; Base_Request Request;&lt;br /&gt;&amp;nbsp;&amp;nbsp; int Address;&lt;br /&gt;&amp;nbsp;&amp;nbsp; int Length;&lt;br /&gt;};&lt;br /&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;This is over simplifies intentionally.&lt;/p&gt;
&lt;p&gt;Asaf&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=478469" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/Embedded/default.aspx">Embedded</category></item><item><title>WinUSB .Net Component</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/29/winusb-net-component.aspx</link><pubDate>Tue, 29 Dec 2009 07:43:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:478195</guid><dc:creator>AsafShelly</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=478195</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=478195</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/29/winusb-net-component.aspx#comments</comments><description>&lt;p&gt;I have uploaded a WinUSB Component for .Net with full source code here: &lt;a class="" href="http://www.asyncop.com/MTnPDirEnum.aspx?treeviewPath=%5bo%5d+Open-Source%5cWinUSB+Component"&gt;WinUSB .Net Component in C#&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The component comes with full source code and has the following features:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/asafshelly/WinUSBPrintScreenProperties.PNG"&gt;&lt;img src="http://blogs.microsoft.co.il/blogs/asafshelly/WinUSBPrintScreenProperties.PNG" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/asafshelly/WinUSBPrintScreenEvents.PNG"&gt;&lt;img src="http://blogs.microsoft.co.il/blogs/asafshelly/WinUSBPrintScreenEvents.PNG" border="0" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=478195" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/Embedded/default.aspx">Embedded</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/WDK/default.aspx">WDK</category></item><item><title>Pacific Software &amp; HPC</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/27/pacific-software-amp-hpc.aspx</link><pubDate>Sun, 27 Dec 2009 14:02:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:476832</guid><dc:creator>AsafShelly</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=476832</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=476832</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/27/pacific-software-amp-hpc.aspx#comments</comments><description>&lt;p dir="rtl"&gt;מזה מספר שנים שחברת &lt;a class="" href="http://pacificsoft.co.il/"&gt;פסיפיק תוכנה&lt;/a&gt; מובילה&amp;nbsp;בתחום הפיתוח המקבילי בארץ. בקרוב מיקרוסופט מוציאה את גרסת Server 2008 HPC R2 ופסיפיק מחפשת מומחי IT שמתעניינים בתחום הקמה ותחזוקה של מערכות HPC&lt;/p&gt;
&lt;p&gt;&amp;nbsp;אסף&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=476832" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/Parallel+Computing/default.aspx">Parallel Computing</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/ITPRO/default.aspx">ITPRO</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/HPC/default.aspx">HPC</category></item><item><title>Verifying C++ Buffers</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/27/verifying-c-buffers.aspx</link><pubDate>Sun, 27 Dec 2009 08:12:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:476629</guid><dc:creator>AsafShelly</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=476629</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=476629</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/27/verifying-c-buffers.aspx#comments</comments><description>&lt;p&gt;This post is following this post: &lt;a href="http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/22/verifying-pointers-in-c.aspx"&gt;Verifying Pointers in C++&lt;/a&gt;&amp;nbsp;which demonstrated the problem in testing a pointer for NULL after allocation like this:&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#548dd4;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-themecolor:text2;mso-themetint:153;"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#548dd4;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-themecolor:text2;mso-themetint:153;"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#548dd4;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-themecolor:text2;mso-themetint:153;"&gt;char&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;"&gt;&lt;font color="#000000"&gt;* &lt;/font&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;ptr&lt;/span&gt;&lt;font color="#000000"&gt;=&lt;/font&gt;&lt;span style="COLOR:#548dd4;mso-themecolor:text2;mso-themetint:153;"&gt;new&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#548dd4;mso-themecolor:text2;mso-themetint:153;"&gt;char&lt;/span&gt;&lt;font color="#000000"&gt;[&lt;/font&gt;&lt;span style="COLOR:#31849b;mso-themecolor:accent5;mso-themeshade:191;"&gt;1&lt;/span&gt;&lt;font color="#000000"&gt;];&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#548dd4;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-themecolor:text2;mso-themetint:153;"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#548dd4;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-themecolor:text2;mso-themetint:153;"&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;"&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#548dd4;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-themecolor:text2;mso-themetint:153;"&gt;if&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;"&gt;&lt;font color="#000000"&gt; (&lt;/font&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;NULL&lt;/span&gt;&lt;font color="#000000"&gt; == &lt;/font&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;ptr&lt;/span&gt;&lt;font color="#000000"&gt;) &lt;/font&gt;&lt;span style="COLOR:gray;mso-themecolor:background1;mso-themeshade:128;"&gt;// fail&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; 
&lt;p&gt;There is another issue with verifying pointers for NULL. The value NULL is #defined as 0 (zero) which is agreed to be an invalid memory address. Testing a pointer to see if it is NULL means testing to see if the pointer is pointing to address zero or not. As we all know,&amp;nbsp;when we allocate a buffer and then delete it we must zero the pointer. Verifying a pointer is relying on the fact that every pointer that does not point to a legal buffer is manually reset. Like this:&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#3a3a3a;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#943634;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-themecolor:accent2;mso-themeshade:191;"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#943634;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-themecolor:accent2;mso-themeshade:191;"&gt;main&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;()&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:#548dd4;mso-themecolor:text2;mso-themetint:153;"&gt;char&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;*&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;ptr&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#2300b0;"&gt;=&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;NULL&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;MyFunc&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;(&lt;/span&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;ptr&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;ptr&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#2300b0;"&gt;=&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#548dd4;mso-themecolor:text2;mso-themetint:153;"&gt;new char&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;[&lt;/span&gt;&lt;span style="COLOR:#148ac2;"&gt;20&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;];&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;MyFunc&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;(&lt;/span&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;ptr&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:#548dd4;mso-themecolor:text2;mso-themetint:153;"&gt;delete&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;[]&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;ptr&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;;&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;ptr&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#2300b0;"&gt;=&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;NULL&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;MyFunc&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;(&lt;/span&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;ptr&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#3a3a3a;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#943634;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-themecolor:accent2;mso-themeshade:191;"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#3a3a3a;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#943634;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-themecolor:accent2;mso-themeshade:191;"&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#548dd4;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-themecolor:text2;mso-themetint:153;"&gt;void&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;MyFunc&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;(&lt;/span&gt;&lt;span style="COLOR:#548dd4;mso-themecolor:text2;mso-themetint:153;"&gt;char&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;*&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;ptr&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;)&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;br /&gt;{&lt;span style="mso-tab-count:1;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:#548dd4;mso-themecolor:text2;mso-themetint:153;"&gt;if&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#2300b0;"&gt;(&lt;/span&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;NULL&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#2300b0;"&gt;==&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#943634;mso-themecolor:accent2;mso-themeshade:191;"&gt;ptr&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;)&lt;/span&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#548dd4;mso-themecolor:text2;mso-themetint:153;"&gt;return&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&lt;font color="#000000"&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;span style="COLOR:gray;mso-themecolor:background1;mso-themeshade:128;"&gt;// ...do something...&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp; 
&lt;p&gt;You may assume that verifying the pointer in MyFunc is fine because the code is verified to make sure that every pointer is correctly initialized to zero and so if a NULL pointer is used the function is protected from it. This is not really the case. To demonstrate the problem we can look at the following scenario.&lt;/p&gt;
&lt;p&gt;We have a class called Label. This class has several members including the text string to display. Here is the class:&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;font color="#3a3a3a"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;class&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;/span&gt;Label&lt;br /&gt;{&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;protected&lt;/span&gt;:&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;int&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#3a3a3a;"&gt;X&lt;/span&gt;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;int&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#3a3a3a;"&gt;Y&lt;/span&gt;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;char&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;*&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#3a3a3a;"&gt;text&lt;/span&gt;&lt;/span&gt;;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;public&lt;/span&gt;:&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;char&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;*&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#3a3a3a;"&gt;Text&lt;/span&gt;&lt;/span&gt;();&lt;br /&gt;};&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;
&lt;p&gt;
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 0pt;DIRECTION:ltr;unicode-bidi:embed;TEXT-ALIGN:left;mso-layout-grid-align:none;"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;void&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;span style="COLOR:#3a3a3a;"&gt;UpdateDisplay&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;()&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="COLOR:#2300b0;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#72846f;"&gt;// ... more&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR:#3a3a3a;"&gt;&lt;font face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp; Label* &lt;span style="COLOR:#3a3a3a;"&gt;label1 = GetSomeL&lt;span style="COLOR:#3a3a3a;"&gt;abel();&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 0pt;DIRECTION:ltr;unicode-bidi:embed;TEXT-ALIGN:left;mso-layout-grid-align:none;"&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#324eba;"&gt;char&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;*&lt;/span&gt; &lt;span style="COLOR:#3a3a3a;"&gt;ptr&lt;/span&gt; &lt;span style="COLOR:#2300b0;"&gt;=&lt;/span&gt; &lt;span style="COLOR:#3a3a3a;"&gt;label1-&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#3a3a3a;"&gt;Text&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#324eba;"&gt;if&lt;/span&gt; &lt;span style="COLOR:#2300b0;"&gt;(&lt;/span&gt;&lt;span style="COLOR:#3a3a3a;"&gt;NULL&lt;/span&gt; &lt;span style="COLOR:#2300b0;"&gt;==&lt;/span&gt; &lt;span style="COLOR:#3a3a3a;"&gt;ptr&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;)&lt;/span&gt; &lt;span style="COLOR:#72846f;"&gt;// ERROR&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="COLOR:#72846f;"&gt;// ... more&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Now, here is the problem:&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;font color="#3a3a3a"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;class&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;/span&gt;Label&lt;br /&gt;{&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;protected&lt;/span&gt;:&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;int&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#3a3a3a;"&gt;X&lt;/span&gt;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;int&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#3a3a3a;"&gt;Y&lt;/span&gt;&lt;/span&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;font style="BACKGROUND-COLOR:#c3d9de;"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;char&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#3a3a3a;"&gt;text[256]&lt;/span&gt;&lt;/span&gt;;&lt;/font&gt;&lt;br /&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;public&lt;/span&gt;:&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;char&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;*&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;&lt;font color="#000000"&gt; &lt;/font&gt;&lt;span style="COLOR:#3a3a3a;"&gt;Text&lt;/span&gt;&lt;/span&gt;();&lt;br /&gt;};&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In the first version of the class the string was a pointer to a memory buffer. In this version the string is stored as part of the object. This means that in the original version the call to &lt;font color="#3a3a3a"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;GetSomeL&lt;span style="COLOR:#3a3a3a;"&gt;abel()&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt; in&amp;nbsp;function &lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:#3a3a3a;"&gt;UpdateDisplay&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;()&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;can return NULL if there is no label and calling the member &lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:#3a3a3a;"&gt;label1-&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#3a3a3a;"&gt;Text&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;()&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;will also return NULL. When we use the second version of the class&amp;nbsp;we find&amp;nbsp;a problem. If the call to &lt;font color="#3a3a3a"&gt;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;GetSomeL&lt;span style="COLOR:#3a3a3a;"&gt;abel()&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt; in&amp;nbsp;function &lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:#3a3a3a;"&gt;UpdateDisplay&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;()&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&amp;nbsp;returns NULL then the calling&amp;nbsp;the member&amp;nbsp;&lt;font size="2"&gt;&lt;font face="Courier New"&gt;&lt;span style="COLOR:#3a3a3a;"&gt;label1-&amp;gt;&lt;/span&gt;&lt;span style="COLOR:#3a3a3a;"&gt;Text&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;()&lt;/span&gt;&lt;/font&gt;&lt;/font&gt; will return 8. Verifying the pointer for NULL will find no problem and using the macro ASSERT will also no find the bug!&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;void&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt; &lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#3a3a3a;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;UpdateDisplay&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;()&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;font color="#3a3a3a"&gt;&lt;br /&gt;&lt;/font&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-ansi-language:EN-US;mso-fareast-language:EN-US;mso-bidi-language:HE;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#72846f;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;// ... more&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Arial&amp;#39;,&amp;#39;sans-serif&amp;#39;;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#3a3a3a;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&amp;nbsp;&amp;nbsp; Label* label1 = GetSomeLabel();&lt;font color="#ff0000"&gt; // Got label1&amp;nbsp;=&amp;nbsp;NULL&amp;nbsp;// label1 = 0&amp;nbsp;&lt;/font&gt;&lt;/span&gt; 
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 0pt;DIRECTION:ltr;unicode-bidi:embed;TEXT-ALIGN:left;mso-layout-grid-align:none;"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;char&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;*&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#3a3a3a;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;ptr&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;=&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#3a3a3a;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;label1-&amp;gt;Text&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#ff0000"&gt;// ptr = label1 + 8&amp;nbsp; // ptr = 8&lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:12pt;COLOR:black;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;if&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;(&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#3a3a3a;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;NULL&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;==&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#3a3a3a;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;ptr&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;)&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#72846f;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;// ERROR&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#ff0000"&gt;// can&amp;#39;t see the problem,&amp;nbsp;ignoring&lt;/font&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:12pt;COLOR:black;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:black;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#72846f;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;// ... more&lt;/span&gt;&lt;span style="FONT-SIZE:12pt;COLOR:black;FONT-FAMILY:&amp;#39;Times New Roman&amp;#39;,&amp;#39;serif&amp;#39;;mso-fareast-font-family:&amp;#39;Times New Roman&amp;#39;;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#2300b0;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;When label1 is NULL the&amp;nbsp;data of label1 starts at address zero; X starts at address zero, Y at address 4&amp;nbsp;which is sizeof(X), after X, and text starts at address 8. Making sure that the string &lt;span style="COLOR:#3a3a3a;"&gt;&lt;font style="BACKGROUND-COLOR:#c3d9de;" face="Courier New" size="2"&gt;text&lt;/font&gt;&lt;/span&gt; is not zero is a bug.&lt;/p&gt;
&lt;p&gt;When we try to access the buffer&amp;nbsp;&lt;span style="COLOR:#3a3a3a;"&gt;&lt;font style="BACKGROUND-COLOR:#c3d9de;" face="Courier New" size="2"&gt;text&lt;/font&gt;&lt;/span&gt; the system will get an exception. This is a CPU exception for accessing the invalid page stating&amp;nbsp;on address zero. If the page size is 4KB then accessing anywhere within the range is invalid and not just address zero, so address 8 is also invalid because it is in the same page. Actually the entire block of memory ranging from address 0 and up to 64KB is marked as inaccessible for this exact reason.&lt;/p&gt;
&lt;p&gt;The way to do this correctly is not to verify that the address is under 64K. Instead you can use the Win32 API IsBadxxxPtr. Just like checking the pointer has to be thread-safe, so does calling these API functions. It is possible that between the verification and the usage some other thread deleted the buffer if you do not make sure that this will not happen. Also this does not replace the need to reset pointers to zero after deleting them. If there is another valid buffer on the same page then the entire page is valid.&lt;/p&gt;
&lt;p&gt;* Note that this API is not recommended by Microsoft for a parallel environment.&lt;/p&gt;
&lt;p&gt;For code example see the &lt;a class="" href="http://www.asyncop.com/MTnPDirEnum.aspx?treeviewPath=%5bo%5d+Open-Source%5cWinModules%5cQuality%5cDebugMode.h"&gt;wrapper code&lt;/a&gt; as it is used internally by the cpp files in this &lt;a class="" href="http://www.asyncop.com/MTnPDirEnum.aspx?treeviewPath=%5bo%5d+Open-Source%5cWinModules"&gt;sample code&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=476629" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/http_3A002F002F00_AsyncOp.com/default.aspx">http://AsyncOp.com</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/DEV/default.aspx">DEV</category></item><item><title>WinUSB Read Problem</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/22/winusb-read-problem.aspx</link><pubDate>Tue, 22 Dec 2009 13:35:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:474955</guid><dc:creator>AsafShelly</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=474955</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=474955</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/22/winusb-read-problem.aspx#comments</comments><description>&lt;p&gt;Hi All,&lt;/p&gt;
&lt;p&gt;I have decided to move forward from my implementation of BulkUSB.sys driver to using the formal implementation called WinUSB. It is a package of a kernel driver and a user-mode API documented as part of the MSDN library.&lt;/p&gt;
&lt;p&gt;When I tried to do asynchronous reads I discovered two undocumented / confusing failures:&lt;/p&gt;
&lt;p&gt;The first is GetLastError returns 997 - ERROR_IO_PENDING. This is fine for overlapped IO. The function fails and the error code means that there is more data to follow.&lt;/p&gt;
&lt;p&gt;The second is somewhat confusing: GetLastError returns&amp;nbsp;121 - ERROR_SEM_TIMEOUT &amp;quot;The semaphore timeout period has expired&amp;quot;. This means that the timeout has expired before the data was ready. The confusing part is that it looks like the call to &lt;font face="courier new,courier"&gt;WinUsb_ReadPipe&lt;/font&gt; will also fail with error code 121 if there is data in the buffer.&lt;/p&gt;
&lt;p&gt;The read function will wait for the buffer to be full or timeout to expire. This means that the call to read will fail with error code 121 even if some data was read from the device and you must check the number of bytes read to know if read really succeeded or not. The logic behind this is that you don&amp;#39;t call GetLastError if the function returns true.&lt;/p&gt;
&lt;p&gt;* to set enpoint timeout use &lt;font face="courier new,courier"&gt;WinUsb_SetPipePolicy&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=474955" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/Embedded/default.aspx">Embedded</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/WDK/default.aspx">WDK</category></item><item><title>Parallel Computing Tutorial</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/22/parallel-computing-tutorial.aspx</link><pubDate>Tue, 22 Dec 2009 09:18:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:474911</guid><dc:creator>AsafShelly</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=474911</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=474911</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/22/parallel-computing-tutorial.aspx#comments</comments><description>&lt;p&gt;With some delay I am&amp;nbsp;publishing a video about parallel programming. This tutorial&amp;nbsp;is loaded with advanced concepts mainly dealing with parallel software design and architecture.&lt;/p&gt;
&lt;p&gt;As some of you may know I have presented &amp;quot;Parallel Programming for Embedded&amp;quot; TechEd 2009 Europe. This is the video. There are no code samples in this presentations because there are too many languages and operating systems that it is irrelevant to show any code. Instead this presentation shows how the hardware has always been parallel and therefore it is a good source for parallel design. Windows Kernel has always been working in parallel as well, but Windows NT kernel is an embedded operating system and has its own compiler.&lt;/p&gt;
&lt;p&gt;The concepts in this video are covered in over 20 days of lectures that I have so it is&amp;nbsp;packed with many advanced concepts.&lt;/p&gt;
&lt;p&gt;The video is currently at the home page of &lt;a href="http://asyncop.com/"&gt;http://AsyncOp.com&lt;/a&gt;. If you can&amp;#39;t see it there then look for it under the Video section, or under Events.&lt;/p&gt;
&lt;p&gt;Asaf&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=474911" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/TechEd/default.aspx">TechEd</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/Parallel+Computing/default.aspx">Parallel Computing</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/multiprocessing/default.aspx">multiprocessing</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/multicore/default.aspx">multicore</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/http_3A002F002F00_AsyncOp.com/default.aspx">http://AsyncOp.com</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/Embedded/default.aspx">Embedded</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/VIDEO/default.aspx">VIDEO</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/TECH/default.aspx">TECH</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/TechEd+Europe+2009/default.aspx">TechEd Europe 2009</category></item><item><title>Verifying Pointers in C++</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/22/verifying-pointers-in-c.aspx</link><pubDate>Tue, 22 Dec 2009 08:49:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:474904</guid><dc:creator>AsafShelly</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=474904</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=474904</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/22/verifying-pointers-in-c.aspx#comments</comments><description>&lt;p&gt;It is well known that C++ is having a few problems with pointers...&lt;/p&gt;
&lt;p&gt;When we used C style &lt;font face="courier new,courier"&gt;malloc( )&lt;/font&gt; and &lt;font face="courier new,courier"&gt;free( )&lt;/font&gt; we verified the returned pointer. If the pointer was NULL (zero) then it was invalid and should not be used.&lt;/p&gt;
&lt;p&gt;Going to C++ we have constructors. A constructor does not have a return value so the only way to notify the caller that the construction failed was using an exception. If my object is using an internal buffer and the system is out of memory then my&amp;nbsp;constructor has to throw an out-of-memory exception.&lt;/p&gt;
&lt;p&gt;The caller who created my object using the new operator will have to catch the exception. This is the only way to know that the creation of the object had failed. Constructors cannot return NULL because an object can also be created in the local scope and then there is no return value.&lt;/p&gt;
&lt;p&gt;All this means that the following is a logical&amp;nbsp;error:&lt;/p&gt;&lt;font face="courier new,courier"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#3a3a3a;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;MyClass&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;span style="COLOR:#2300b0;"&gt;*&lt;/span&gt;&lt;span style="COLOR:#3a3a3a;"&gt;ptr&lt;/span&gt; &lt;span style="COLOR:#2300b0;"&gt;=&lt;/span&gt; &lt;span style="COLOR:#324eba;"&gt;new&lt;/span&gt; &lt;span style="COLOR:#3a3a3a;"&gt;MyClass&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;(&lt;/span&gt;&lt;span style="COLOR:#148ac2;"&gt;12&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;);&lt;/span&gt;&lt;/span&gt; 
&lt;p class="MsoNormal" style="MARGIN:0cm 0cm 0pt;DIRECTION:ltr;unicode-bidi:embed;TEXT-ALIGN:left;"&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;if&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;span style="COLOR:#2300b0;"&gt;(!&lt;/span&gt;&lt;span style="COLOR:#3a3a3a;"&gt;ptr&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;)&lt;/span&gt; &lt;span style="COLOR:#324eba;"&gt;return&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;(&lt;/span&gt;&lt;span style="COLOR:#3a3a3a;"&gt;ERROR_CODE_FAIL&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;);&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;There is an error because C++ will make sure that an exception is thrown in case of an error so&amp;nbsp;the code flow will break before the&amp;nbsp;second line and therefore&amp;nbsp;the second line will only execute if the pointer has a valid value.&lt;/p&gt;
&lt;p&gt;Here is one way to do this correctly:&lt;/p&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#3a3a3a;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;MyClass&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;span style="COLOR:#2300b0;"&gt;*&lt;/span&gt;&lt;span style="COLOR:#3a3a3a;"&gt;ptr&lt;/span&gt; &lt;span style="COLOR:#2300b0;"&gt;=&lt;/span&gt; &lt;span style="COLOR:#3a3a3a;"&gt;null&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;try&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;span style="COLOR:#2300b0;"&gt;{&lt;/span&gt; &lt;span style="COLOR:#3a3a3a;"&gt;ptr&lt;/span&gt; &lt;span style="COLOR:#2300b0;"&gt;=&lt;/span&gt; &lt;span style="COLOR:#324eba;"&gt;new&lt;/span&gt; &lt;span style="COLOR:#3a3a3a;"&gt;MyClass&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;(&lt;/span&gt;&lt;span style="COLOR:#148ac2;"&gt;12&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;);&lt;/span&gt; &lt;span style="COLOR:#2300b0;"&gt;}&lt;/span&gt; &lt;span style="COLOR:#324eba;"&gt;catch&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;(...)&lt;/span&gt; &lt;span style="COLOR:#2300b0;"&gt;{&lt;/span&gt; &lt;span style="COLOR:#3a3a3a;"&gt;ptr&lt;/span&gt; &lt;span style="COLOR:#2300b0;"&gt;=&lt;/span&gt; &lt;span style="COLOR:#3a3a3a;"&gt;NULL&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;;&lt;/span&gt; &lt;span style="COLOR:#2300b0;"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;COLOR:#324eba;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt;if&lt;/span&gt;&lt;span style="FONT-SIZE:10pt;FONT-FAMILY:&amp;#39;Courier New&amp;#39;;mso-no-proof:yes;"&gt; &lt;span style="COLOR:#2300b0;"&gt;(!&lt;/span&gt;&lt;span style="COLOR:#3a3a3a;"&gt;ptr&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;)&lt;/span&gt; &lt;span style="COLOR:#324eba;"&gt;return&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;(&lt;/span&gt;&lt;span style="COLOR:#3a3a3a;"&gt;ERROR_CODE_FAIL&lt;/span&gt;&lt;span style="COLOR:#2300b0;"&gt;);&lt;/span&gt;&lt;/span&gt; 
&lt;p&gt;
&lt;p&gt;You can also look for the reserved word &lt;font face="courier new,courier"&gt;&lt;strong&gt;nothrow&lt;/strong&gt;&lt;/font&gt; which is a Microsoft Visual C++ extension.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://asyncop.com/"&gt;http://AsyncOp.com&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=474904" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/DEV/default.aspx">DEV</category></item><item><title>Open Source Libraries for windows</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/20/open-source-libraries-for-windows.aspx</link><pubDate>Sun, 20 Dec 2009 07:51:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:473752</guid><dc:creator>AsafShelly</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=473752</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=473752</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/12/20/open-source-libraries-for-windows.aspx#comments</comments><description>&lt;p&gt;Hi All,&lt;/p&gt;
&lt;p&gt;As you can see I have upgraded the shared-source engine (see my previous post &lt;a href="http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/04/21/sharing-my-source.aspx"&gt;http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/04/21/sharing-my-source.aspx&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;The Open-Source section in &lt;a href="http://www.asyncop.com/"&gt;www.AsyncOp.com&lt;/a&gt; now has the complete collection of modules and C++ classes that I have been using for Windows. These include threading and shared memory classes, string classes, communications, graphics and more. Not exactly MFC style classes but will work with MFC.&lt;/p&gt;
&lt;p&gt;The code is compatible with MFC, Borland C++, Managed C++, and will also work with native Win32 API.&lt;/p&gt;
&lt;p&gt;For example the text class can open a web-page and read from it using&amp;nbsp;&amp;gt;&amp;gt; operators. It can also find an HTML title by using wPage(&amp;quot;&amp;lt;head&amp;gt;&amp;quot;,&amp;quot;&amp;lt;/head&amp;gt;&amp;quot;)[1](&amp;quot;&amp;lt;title&amp;gt;&amp;quot;,&amp;quot;&amp;lt;/title&amp;gt;&amp;quot;)[1]&lt;/p&gt;
&lt;p&gt;You are welcome to use the code, parts of the code, and the dll as a library.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.asyncop.com/MTnPDirEnum.aspx?treeviewPath=%5bo%5d+Open-Source%5cWinModules"&gt;http://www.asyncop.com/MTnPDirEnum.aspx?treeviewPath=%5bo%5d+Open-Source%5cWinModules&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Asaf&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=473752" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/TechEd/default.aspx">TechEd</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/Parallel+Computing/default.aspx">Parallel Computing</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/multiprocessing/default.aspx">multiprocessing</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/multicore/default.aspx">multicore</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/DEV/default.aspx">DEV</category></item><item><title>TechEd 2009 Europe</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/11/05/teched-2009-europe.aspx</link><pubDate>Thu, 05 Nov 2009 21:22:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:439518</guid><dc:creator>AsafShelly</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=439518</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=439518</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/11/05/teched-2009-europe.aspx#comments</comments><description>&lt;div&gt;
&lt;p&gt;Hi All,&lt;/p&gt;
&lt;p&gt;If you are coming to this year&amp;#39;s TechEd in Europe let me know about it.&lt;/p&gt;
&lt;p&gt;You are also welcome to join my session on Friday titled &amp;quot;Parallel Programming for Embedded&amp;quot;. The session covers parallel computing in general and in particular for embedded systems. The most important part is that it is using a language that infrastructure people can relate to. If you ever used DOS, Device Drivers, low level C and C++, and basic Win32 API then you should come. The session uses this to your advantage. On the other hand web developers will fins this eye opening.&lt;/p&gt;
&lt;p&gt;&lt;img style="WIDTH:540px;HEIGHT:388px;" height="476" alt="439524" src="http://blogs.microsoft.co.il/files/folders/439524/download.aspx" width="634" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;The hardware was always parallel and therefore the kernel environment has always been fully parallel, and guess what, It is working.&lt;/p&gt;
&lt;p&gt;&lt;img height="404" alt="DevicePool" src="http://blogs.microsoft.co.il/files/folders/439577/download.aspx" width="538" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;img style="WIDTH:533px;HEIGHT:389px;" height="476" alt="lock-stop" src="http://blogs.microsoft.co.il/files/folders/439576/download.aspx" width="634" border="0" /&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;/p&gt;
&lt;p&gt;Asaf&lt;/p&gt;&lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=439518" width="1" height="1"&gt;</description><enclosure url="http://blogs.microsoft.co.il/blogs/asafshelly/attachment/439518.ashx" length="37546" type="image/jpeg" /><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/TechEd/default.aspx">TechEd</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/Parallel+Computing/default.aspx">Parallel Computing</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/multiprocessing/default.aspx">multiprocessing</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/multicore/default.aspx">multicore</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/http_3A002F002F00_AsyncOp.com/default.aspx">http://AsyncOp.com</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/Embedded/default.aspx">Embedded</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/TECH/default.aspx">TECH</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/TechEd+Europe+2009/default.aspx">TechEd Europe 2009</category></item><item><title>A book about R&amp;D - Need your help</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/10/08/a-book-about-r-amp-d-need-your-help.aspx</link><pubDate>Thu, 08 Oct 2009 19:25:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:421701</guid><dc:creator>AsafShelly</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=421701</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=421701</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/10/08/a-book-about-r-amp-d-need-your-help.aspx#comments</comments><description>&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;There are many books about C\++, C#, VB, Java and other languages. There are also books about MFC, WPF, Windows Networking, and many other technologies.&lt;/p&gt;
&lt;p&gt;All these books teach us the language features and what the different technologies have to offer.&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t seen&amp;nbsp;a single good book that will teach me how to effectively do my job in R&amp;amp;D. I still remember my first job in a&amp;nbsp;hi-tech company: I was given a collection of technical books. After I read all these books I still didn&amp;#39;t really know what I was expected to do and how to do my job. I went to the big book stores in Israel looking for a book about R&amp;amp;D, and guess what...&amp;nbsp;I am still looking for that book.&lt;/p&gt;
&lt;p&gt;Don&amp;#39;t you&amp;nbsp;agree with me? I would really like to read&amp;nbsp;such a&amp;nbsp;book and especially be able to give a book about R&amp;amp;D to new employees.&lt;/p&gt;
&lt;p&gt;What do you think?&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=421701" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/TECH/default.aspx">TECH</category></item><item><title>תכנות מקבילי - אירוע חד יומי</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/09/03/394596.aspx</link><pubDate>Thu, 03 Sep 2009 05:25:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:394596</guid><dc:creator>AsafShelly</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=394596</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=394596</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/09/03/394596.aspx#comments</comments><description>&lt;p dir="rtl"&gt;באירוע ה- TechEd האחרון העברתי הרצאה בנושא עבודה מקבילית עם C#. בתקופה ההיא הנושא עוד היה חדש וזאת היתה ההרצאה היחידה. ההענות היתה טובה מאד ולמרות שההרצאה היתה בשעה 8 בבוקר האולם היה מלא עד אפס מקום ובתמונות ניתן לראות את המסדרון מחוץ לאולם מלא&amp;nbsp;עד שאין מקום עמידה&amp;nbsp;(&lt;a class="" href="http://www.asyncop.com/MTnPDirEnum.aspx?treeviewPath=%5bs%5d+Events%5c%5bd%5d+TechEd+2008+-+April+2008+Israel%5c%5bm%5d+Pictures"&gt;צפיה בתמונות&lt;/a&gt;). מכיוון שהיתה היענות כל כך חיובית היו מספר אירועים נוספים שעקבו בניהם יום פתוח בחסות מיקרוסופט ומספר רב של אירועים אחרים. עם הזמן עברתי להוביל את התחום בחברת פסיפיק תוכנה, הקמנו שישה קורסים שונים עם סך&amp;nbsp;הכל של&amp;nbsp;20 ימי הדרכה בנושאים שונים.&lt;/p&gt;
&lt;p dir="rtl"&gt;האירוע הבא יתקיים ב- 24 לחודש ספטמבר. מדובר בכנס חד יומי שמטרתו מתחלקת לשני חלקים: 1. לאפשר למתכנת להתחיל לעבוד בעולם המקבילי&amp;nbsp;בצורה נכונה&amp;nbsp;ובאופן מיידי, ו- 2. להבין את התחום, מה כדאי למקבל ומה לא, להבין את השפה שבה משתמשים בעולם המקבילי, ולדעת מה בעתיד - למשל המעבד החדש של אינטל (שעוד לא יצא) ימקבל אלגוריתמים בצורה שונה לחלוטין וכך למשל חיפוש ומיון יעבדו משמעותית יותר מהר מאשר היום, אם הקוד כתוב נכון.&lt;/p&gt;
&lt;p dir="rtl"&gt;הידע שמועבר בכנס מבוסס על הקורסים שאנחנו מעבירים, על בלוגים (בעיקר של אינטל) וחומר מהקהילה, ועל מצגות שיווקיות וטכניות של חברות בתחום. ההרצאות עונות על אוסף השאלות שעלו במסגרת הייעוץ וההדרכות שהעברנו לחברות בארץ בשנים האחרונות, החל בשאלות של מוטורולה בנושא עבודה מקבילית של בקרי תקשורת חומרתיים,&amp;nbsp;הצורך של צ&amp;#39;ק פוינט להתאים שכבות פיתוח מעל מערכות הפעלה שונות, ועד HPC וארכיטקטורה תומכת SOA. אותן השאלות חוזרות שוב ושוב בתחומים השונים. עבודה מקבילית היא לא תחום בתכנות אלא שיטת עבודה שמשפיעה על כל תחומי הפיתוח.&lt;/p&gt;
&lt;p dir="rtl"&gt;פרטים נוספים בקישור: &lt;a href="http://www.pacificsoft.co.il/course.asp?p=671&amp;amp;s=1255"&gt;http://www.pacificsoft.co.il/course.asp?p=671&amp;amp;s=1255&lt;/a&gt;&lt;/p&gt;
&lt;p dir="rtl"&gt;חלק מעקרונות המפתח בהרצאות מבוסס על חומרים שפרסמתי בבלוג של אינטל: &lt;a href="http://software.intel.com/en-us/profile/326676/"&gt;http://software.intel.com/en-us/profile/326676/&lt;/a&gt;&lt;/p&gt;
&lt;p dir="rtl"&gt;נשמח לראותכם שם.&lt;/p&gt;
&lt;p dir="rtl"&gt;אסף&lt;/p&gt;
&lt;p dir="rtl"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p dir="rtl"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p dir="rtl"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p dir="rtl"&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=394596" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/Parallel+Computing/default.aspx">Parallel Computing</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/multiprocessing/default.aspx">multiprocessing</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/multicore/default.aspx">multicore</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/http_3A002F002F00_AsyncOp.com/default.aspx">http://AsyncOp.com</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/DEV/default.aspx">DEV</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/TECH/default.aspx">TECH</category></item><item><title>ותודה רבה לאורי</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/07/21/369418.aspx</link><pubDate>Tue, 21 Jul 2009 20:35:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:369418</guid><dc:creator>AsafShelly</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=369418</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=369418</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/07/21/369418.aspx#comments</comments><description>&lt;p dir="rtl" style="TEXT-ALIGN:right;"&gt;בין כל הפוסטים הטכניים הכבדים היה נראה לי ראוי ונכון לדבר על דברים קצת יותר שמחים.מי שהגיע לחתונה שלנו בערב ל&amp;quot;ג בעומר הופתע לשמוע את הזמר אורי פיינמן שר את הסלואו ומוסיף כמה מילים אישיות. מה שלא ידעתם הוא שהשיר שלצליליו צעדנו לחופה היה שיר חדש שעוד לא פורסם, או בעצם יותר נכון פורסם רק השבוע. דואט מרהיב שמשלב את אורי פיינמן ומורן אהרוני בשיר אחד.&lt;/p&gt;
&lt;p dir="rtl" style="TEXT-ALIGN:right;"&gt;ליאור צורף לימד אותי שפוסט טוב כולל תוכן עשיר כמו וידאו, אז הנה קטע מהחופה: &lt;/p&gt;
&lt;p dir="rtl" style="TEXT-ALIGN:right;"&gt;&lt;embed src="http://www.youtube.com/v/Rz0mwtBNcgw&amp;amp;hl=en&amp;amp;fs=1" width="425" height="344" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always"&gt;&lt;/embed&gt;&amp;nbsp;&lt;/p&gt;
&lt;p dir="rtl" style="TEXT-ALIGN:right;"&gt;למי שרוצה לשמוע את כל השיר - קיבלתי לכך אישור מיוחד &amp;quot;מההפקה&amp;quot;:&lt;/p&gt;
&lt;p dir="rtl" style="TEXT-ALIGN:right;"&gt;&amp;nbsp;&lt;embed src="http://www.youtube.com/v/L7-caoKwmyc&amp;amp;hl=en&amp;amp;fs=1" width="425" height="344" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always"&gt;&lt;/embed&gt;&lt;/p&gt;
&lt;p dir="rtl" style="TEXT-ALIGN:right;"&gt;תהנו.&amp;nbsp;ואה, כן, אורי - תודה רבה על הכל. אני יודע שהתודה קצת מאוחרת אבל אפילו על התמונות של החתונה עוד לא עברנו...&amp;nbsp; &lt;/p&gt;
&lt;p dir="rtl" style="TEXT-ALIGN:right;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p dir="rtl" style="TEXT-ALIGN:right;"&gt;פרטים נוספים על השיר והדיסק החדש תוכלו למצא באתר הרשמי של אורי פיינמן &lt;a href="http://uri-fineman.com/"&gt;http://uri-fineman.com/&lt;/a&gt; ותתפלאו לשמוע שאת ה- Flash באתר אורי תכנת בעצמו! (ליאור צורף, האם בשנים שאתם מכירים ידעת את זה על אורי?)&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=369418" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/OFFTOPIC/default.aspx">OFFTOPIC</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/VIDEO/default.aspx">VIDEO</category></item><item><title>Sharing My Source</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/04/21/sharing-my-source.aspx</link><pubDate>Tue, 21 Apr 2009 13:24:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:272598</guid><dc:creator>AsafShelly</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=272598</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=272598</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/04/21/sharing-my-source.aspx#comments</comments><description>&lt;p&gt;&lt;font face="arial,helvetica,sans-serif"&gt;Hi all,&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="arial,helvetica,sans-serif"&gt;As some of you may&amp;nbsp;know I have a huge collection of applications and &lt;strong&gt;code samples&lt;/strong&gt;. I don&amp;#39;t have a degree so all my studies were by designing and writing tools&amp;nbsp;and projects. It was clear to me for some while that I should publish this code. I even tried to do this once before but it is not so simple. The code looks bad when it is viewed as a simple &lt;strong&gt;text file&lt;/strong&gt; over the web. Coloring is problematic because you need to deal with it over and over again whenever you have a bug fixed.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="arial,helvetica,sans-serif"&gt;Bottom line is that I decided to finally do it. It took me less than 12 hour of work to produce a text parser that produces &lt;strong&gt;HTML&lt;/strong&gt; files&amp;nbsp;for &lt;strong&gt;c/++/#&lt;/strong&gt; files. It is only appropriate (and simple :) to share the source code of this generator as the first project that I share.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="http://asyncop.com/Link.aspx?Open-Source"&gt;http://asyncop.com/Link.aspx?Open-Source&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="arial,helvetica,sans-serif"&gt;I will eventually find the time to produce some management system so I can add new projects without too much trouble.&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="arial,helvetica,sans-serif"&gt;The&amp;nbsp;&lt;strong&gt;project publisher tool&lt;/strong&gt;&amp;nbsp;has&amp;nbsp;three basic elements:&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="arial,helvetica,sans-serif"&gt;A C# library with &lt;font color="#000000"&gt;&lt;span style="TEXT-DECORATION:none;"&gt;&lt;em&gt;ProjectPublisher.cs &lt;/em&gt;&lt;/span&gt;&lt;/font&gt;which is the engine, a C# WebService that uses the library with the source file &lt;font color="#000000"&gt;&lt;span style="TEXT-DECORATION:none;"&gt;&lt;em&gt;ProjectPublisherWSvc.asmx.cs&lt;/em&gt;, and a simple web page demonstrating the use of the WebService called &lt;font color="#000000"&gt;&lt;span style="TEXT-DECORATION:none;"&gt;&lt;em&gt;Default use of ProjectPublisherWS.aspx.cs.&lt;/em&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="arial,helvetica,sans-serif"&gt;&lt;font color="#000000"&gt;&lt;span style="TEXT-DECORATION:none;"&gt;&lt;font color="#000000"&gt;&lt;span style="TEXT-DECORATION:none;"&gt;The source files are parsed on demand so the original file on the server is the clean source file. This way I can update the sample by copying the new C\++\# file using the FTP folder. I am assuming that there won&amp;#39;t be more than one request per second and if there is then I can always turn on the cache on the firewall.&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="arial,helvetica,sans-serif"&gt;&lt;font color="#000000"&gt;&lt;span style="TEXT-DECORATION:none;"&gt;&lt;font color="#000000"&gt;&lt;span style="TEXT-DECORATION:none;"&gt;The WebService is open to the public so you can simply send a string read from a source file and the server will return an HTML file. The reserved words are in arrays and the color tagging are members to&amp;nbsp;a class. It should be easy to add API that receives the list of reserved words and color schemes.&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="arial,helvetica,sans-serif"&gt;&lt;font color="#000000"&gt;&lt;span style="TEXT-DECORATION:none;"&gt;&lt;font color="#000000"&gt;&lt;span style="TEXT-DECORATION:none;"&gt;WebService URL is: &lt;a href="http://services.asyncop.com/ProjectPublisher/ProjectPublisherWSvc.asmx"&gt;http://services.asyncop.com/ProjectPublisher/ProjectPublisherWSvc.asmx&lt;/a&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="arial,helvetica,sans-serif"&gt;&lt;font color="#000000"&gt;&lt;span style="TEXT-DECORATION:none;"&gt;&lt;font color="#000000"&gt;&lt;span style="TEXT-DECORATION:none;"&gt;Let me know if you find any bugs. This is still only 12 hours of work for coding, designing, debugging, testing, and integration with the AsyncOp website...&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;&lt;font face="arial,helvetica,sans-serif"&gt;Regards,&lt;/font&gt;&lt;/p&gt;
&lt;p&gt;Asaf&lt;/p&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=272598" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/http_3A002F002F00_AsyncOp.com/default.aspx">http://AsyncOp.com</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/DEV/default.aspx">DEV</category></item><item><title>World of Parallel Computing</title><link>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/04/05/world-of-parallel-computing.aspx</link><pubDate>Sun, 05 Apr 2009 12:46:00 GMT</pubDate><guid isPermaLink="false">b5c4f5bc-c09b-4439-a595-91a98c1847df:265025</guid><dc:creator>AsafShelly</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/rsscomments.aspx?PostID=265025</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://blogs.microsoft.co.il/blogs/asafshelly/commentapi.aspx?PostID=265025</wfw:comment><comments>http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/04/05/world-of-parallel-computing.aspx#comments</comments><description>&lt;div&gt;
&lt;p&gt;I was reading Sasha&amp;#39;s blog post about &lt;strong&gt;parallel computing&lt;/strong&gt; and went over the presentation slides.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/sasha/archive/2009/04/04/concurrent-programming-msdn-event.aspx"&gt;&lt;font color="#800080"&gt;http://blogs.Microsoft.co.il/blogs/sasha/archive/2009/04/04/concurrent-programming-msdn-event.aspx&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It looks somewhat different than mine, even though I can only assume that the goals and the audience were pretty much the same.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/asafshelly/archive/2009/04/05/video-introduction-to-multicore-programming.aspx"&gt;&lt;font color="#800080"&gt;http://blogs.Microsoft.co.il/blogs/asafshelly/archive/2009/04/05/video-introduction-to-multicore-programming.aspx&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is usually because &amp;#39;we are not there yet&amp;#39;. Meaning, we don&amp;#39;t really have all the answers. If you ask someone about UML you will usually receive the same answers. This is because everyone is in agreement about the fundamental issues.&lt;/p&gt;
&lt;p&gt;This is not the case with parallel computing.&lt;/p&gt;
&lt;p&gt;The first thing that comes to mind is that most people either do &lt;strong&gt;Procedural C programming&lt;/strong&gt; or &lt;strong&gt;Object Oriented programming&lt;/strong&gt; and design. Sasha mentions that working in parallel takes another big leap, just like the one from C to C++. These are two completely different ways of thinking.&lt;/p&gt;
&lt;p&gt;I take&amp;nbsp;this concept one step further to&amp;nbsp;say that: If we need to move forward from&amp;nbsp;what we know - Procedural and Object Oriented&amp;nbsp;Programming, then this means that both are old and out-of-date. If we move forward then this has to mean that what we have today is wrong! Doing &lt;strong&gt;Task Oriented Programming&lt;/strong&gt; with OOD is as bad as doing OOP with C.&lt;/p&gt;
&lt;p&gt;Most architects today are used to working with C++ and C#. Most Realtime programmers are used to C. OOP is very good for managing large fragments of code where as Procedural C is very good in managing flow. In Procedural programming a function is used to implement a Procedure. A Procedure is a process or something that happens and has a flow. In OOP classes are used to represent objects.&lt;/p&gt;
&lt;p&gt;What we are looking for is something completely different.&lt;/p&gt;
&lt;p&gt;We will still be using classes and functions but now it will not be for procedures and objects. It would be for tasks.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Welcome to the new world of programming.&lt;/p&gt;
&lt;p&gt;Asaf&lt;/p&gt;&lt;/div&gt;&lt;img src="http://blogs.microsoft.co.il/aggbug.aspx?PostID=265025" width="1" height="1"&gt;</description><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/Parallel+Computing/default.aspx">Parallel Computing</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/multiprocessing/default.aspx">multiprocessing</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/multicore/default.aspx">multicore</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/http_3A002F002F00_AsyncOp.com/default.aspx">http://AsyncOp.com</category><category domain="http://blogs.microsoft.co.il/blogs/asafshelly/archive/tags/DEV/default.aspx">DEV</category></item></channel></rss>