<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss'><id>tag:blogger.com,1999:blog-459458859817042968</id><updated>2009-05-02T14:08:39.780-07:00</updated><title type='text'>Artak's Tech Blog</title><subtitle type='html'></subtitle><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/posts/default'/><link rel='alternate' type='text/html' href='http://www.kalantarian.org/artak/techblog/'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.kalantarian.org/artak/techblog/atom.xml'/><author><name>Artak</name><uri>http://www.blogger.com/profile/01416044052053974523</uri><email>noreply@blogger.com</email></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-459458859817042968.post-5637294891910076735</id><published>2009-05-02T13:21:00.000-07:00</published><updated>2009-05-02T14:08:39.789-07:00</updated><title type='text'>Hold'em Simulator</title><content type='html'>We just released Burly Marmot Software Hold'em Simulator.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://holdem-odds.com/"&gt;http://holdem-odds.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The easy to use program estimates hand odds and provides all sorts of statistics.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='http://res1.blogblog.com/tracker/459458859817042968-5637294891910076735?l=www.kalantarian.org%2Fartak%2Ftechblog'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/5637294891910076735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=459458859817042968&amp;postID=5637294891910076735' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/posts/default/5637294891910076735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/posts/default/5637294891910076735'/><link rel='alternate' type='text/html' href='http://www.kalantarian.org/artak/techblog/2009/05/holdem-simulator.html' title='Hold&apos;em Simulator'/><author><name>Artak</name><uri>http://www.blogger.com/profile/01416044052053974523</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-459458859817042968.post-1583915429737172815</id><published>2008-09-11T20:41:00.000-07:00</published><updated>2008-09-11T20:48:38.120-07:00</updated><title type='text'>Events versus delegates in C#</title><content type='html'>Finally somebody clearly defined the difference between C# events and multicast delegates.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://blog.monstuff.com/archives/000040.html"&gt;http://blog.monstuff.com/archives/000040.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Conclusion&lt;/em&gt;&lt;br /&gt;We have seen that the event keyword is a modifier for a delegate declaration that allows it to be included in an interface, constraints it invocation from within the class that declares it, provides it with a pair of customizable accessors (add and remove) and forces the signature of the delegate (when used within the .NET framework).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='http://res1.blogblog.com/tracker/459458859817042968-1583915429737172815?l=www.kalantarian.org%2Fartak%2Ftechblog'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/1583915429737172815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=459458859817042968&amp;postID=1583915429737172815' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/posts/default/1583915429737172815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/posts/default/1583915429737172815'/><link rel='alternate' type='text/html' href='http://www.kalantarian.org/artak/techblog/2008/09/events-versus-delegates-in-c.html' title='Events versus delegates in C#'/><author><name>Artak</name><uri>http://www.blogger.com/profile/01416044052053974523</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-459458859817042968.post-6763196902992805358</id><published>2008-07-01T13:56:00.000-07:00</published><updated>2008-07-02T22:42:44.207-07:00</updated><title type='text'>"delete []" versus just "delete" in C++</title><content type='html'>This week I was asked for the second time to "fix" a bug in my code and use "delete []" on arrays instead of "delete". I did an informal survey and all of the people I asked told me using plain "delete" on arrays is wrong.&lt;br /&gt;&lt;br /&gt;As I remembered that it is ok, I decided to do some experiments.&lt;br /&gt;&lt;br /&gt;I wrote this code and compiled it in VS2008:&lt;br /&gt;&lt;br /&gt;&lt;pre style="font-size:small"&gt;&lt;br /&gt;#include "stdafx.h"&lt;br /&gt;TCHAR * buf = NULL;&lt;br /&gt;int * intbuf = NULL;&lt;br /&gt;&lt;br /&gt;class Foo&lt;br /&gt;{&lt;br /&gt;   public:&lt;br /&gt;   int x;&lt;br /&gt;   // ~Foo() { x = 2; }&lt;br /&gt;};&lt;br /&gt;Foo * fooBuf = NULL;&lt;br /&gt;&lt;br /&gt;int _tmain(int argc, _TCHAR* argv[])&lt;br /&gt;{&lt;br /&gt;   delete buf;&lt;br /&gt;   delete [] buf;&lt;br /&gt;   delete intbuf;&lt;br /&gt;   delete [] intbuf;&lt;br /&gt;   delete fooBuf;&lt;br /&gt;   delete [] fooBuf;&lt;br /&gt;   return 0;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now let us check the disassembly:&lt;br /&gt;&lt;pre style="font-size:small"&gt;&lt;br /&gt;         delete buf;&lt;br /&gt;003E1000 mov eax,dword ptr [buf (3E3370h)]&lt;br /&gt;003E1005 push eax&lt;br /&gt;003E1006 call operator delete (3E105Ch)&lt;br /&gt;         delete [] buf;&lt;br /&gt;003E100B mov eax,dword ptr [buf (3E3370h)]&lt;br /&gt;003E1011 push eax&lt;br /&gt;003E1012 call operator delete (3E105Ch)&lt;br /&gt;&lt;br /&gt;         delete intbuf;&lt;br /&gt;003E1017 mov eax,dword ptr [intbuf (3E3374h)]&lt;br /&gt;003E101D push eax&lt;br /&gt;003E101E call operator delete (3E105Ch)&lt;br /&gt;         delete [] intbuf;&lt;br /&gt;003E1023 mov eax,dword ptr [intbuf (3E3374h)]&lt;br /&gt;003E1028 push eax&lt;br /&gt;003E1029 call operator delete (3E105Ch)&lt;br /&gt;&lt;br /&gt;         delete fooBuf;&lt;br /&gt;003E102E mov eax,dword ptr [fooBuf (3E3378h)]&lt;br /&gt;003E1034 push eax&lt;br /&gt;003E1035 call operator delete (3E105Ch)&lt;br /&gt;         delete [] fooBuf;&lt;br /&gt;003E103A mov eax,dword ptr [fooBuf (3E3378h)]&lt;br /&gt;003E1040 push eax&lt;br /&gt;003E1041 call operator delete (3E105Ch)&lt;br /&gt;&lt;br /&gt;003E1046 add esp,18h&lt;br /&gt;&lt;br /&gt;         return 0;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;All identical.&lt;br /&gt;&lt;br /&gt;Now if you uncomment the destructor interesting things start to happen on the last two deletes:&lt;br /&gt;&lt;pre style="font-size:small"&gt;&lt;br /&gt;         delete fooBuf;&lt;br /&gt;002C103E mov eax,dword ptr [fooBuf (2C3378h)]&lt;br /&gt;002C1043 add esp,10h&lt;br /&gt;002C1046 test eax,eax&lt;br /&gt;002C1048 je wmain+71h (2C1081h)&lt;br /&gt;002C104A push eax&lt;br /&gt;002C104B mov dword ptr [eax],2&lt;br /&gt;002C1051 call operator delete (2C1094h)&lt;br /&gt;002C1056 mov eax,dword ptr [fooBuf (2C3378h)]&lt;br /&gt;002C105B add esp,4&lt;br /&gt;&lt;br /&gt;         delete [] fooBuf;&lt;br /&gt;002C105E test eax,eax&lt;br /&gt;002C1060 je wmain+71h (2C1081h)&lt;br /&gt;002C1062 mov ecx,dword ptr [eax-4]&lt;br /&gt;002C1065 push esi&lt;br /&gt;002C1066 lea esi,[eax-4]&lt;br /&gt;002C1069 push offset Foo::~Foo (2C1000h)&lt;br /&gt;002C106E push ecx&lt;br /&gt;002C106F push 4&lt;br /&gt;002C1071 push eax&lt;br /&gt;002C1072 call `eh vector destructor iterator' (2C10F8h)&lt;br /&gt;002C1077 push esi&lt;br /&gt;002C1078 call operator delete (2C1094h)&lt;br /&gt;002C107D add esp,4&lt;br /&gt;002C1080 pop esi&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The calls are very different because in second case it goes through the array and destructs individual elements, while in the first just deletes the memory.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br /&gt;“delete” and “delete []” are equivalent unless the array contains objects and that objects have a destructor.&lt;br /&gt;&lt;br /&gt;This said it is still probably good idea to use "delete []" for the clarity alone.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='http://res1.blogblog.com/tracker/459458859817042968-6763196902992805358?l=www.kalantarian.org%2Fartak%2Ftechblog'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/6763196902992805358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=459458859817042968&amp;postID=6763196902992805358' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/posts/default/6763196902992805358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/posts/default/6763196902992805358'/><link rel='alternate' type='text/html' href='http://www.kalantarian.org/artak/techblog/2008/07/delete-versus-just-delete.html' title='&quot;delete []&quot; versus just &quot;delete&quot; in C++'/><author><name>Artak</name><uri>http://www.blogger.com/profile/01416044052053974523</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-459458859817042968.post-6169457960795566948</id><published>2008-06-10T16:07:00.000-07:00</published><updated>2008-06-10T16:13:05.869-07:00</updated><title type='text'>.NET Zero</title><content type='html'>I second &lt;a href="http://blogs.msdn.com/digitalnetbizz/archive/2007/01/27/net-book-zero.aspx"&gt;digitalnetbizz.&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The most amazing book about .NET is free and is available at &lt;a href="http://www.charlespetzold.com/dotnet/index.html"&gt; Charles Petzold's web site. &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In general check out everything written by Charles. He is a category of his own among technology writers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='http://res1.blogblog.com/tracker/459458859817042968-6169457960795566948?l=www.kalantarian.org%2Fartak%2Ftechblog'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/6169457960795566948/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=459458859817042968&amp;postID=6169457960795566948' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/posts/default/6169457960795566948'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/posts/default/6169457960795566948'/><link rel='alternate' type='text/html' href='http://www.kalantarian.org/artak/techblog/2008/06/net-zero.html' title='.NET Zero'/><author><name>Artak</name><uri>http://www.blogger.com/profile/01416044052053974523</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-459458859817042968.post-7066049142858062887</id><published>2008-06-03T18:40:00.000-07:00</published><updated>2008-07-02T22:26:54.970-07:00</updated><title type='text'>Breaking the Myth of Megapixels</title><content type='html'>You would think, that by now the computer magazines would manage to get it right.&lt;br /&gt;&lt;br /&gt;Well, &lt;a href="http://www.nytimes.com/2007/02/08/technology/08pogue.html?_r=2&amp;amp;ref=technology&amp;amp;oref=slogin&amp;amp;oref=slogin"&gt;at least someone who writes for NY times does. &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='http://res1.blogblog.com/tracker/459458859817042968-7066049142858062887?l=www.kalantarian.org%2Fartak%2Ftechblog'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/7066049142858062887/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=459458859817042968&amp;postID=7066049142858062887' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/posts/default/7066049142858062887'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/posts/default/7066049142858062887'/><link rel='alternate' type='text/html' href='http://www.kalantarian.org/artak/techblog/2008/06/breaking-myth-of-megapixels.html' title='Breaking the Myth of Megapixels'/><author><name>Artak</name><uri>http://www.blogger.com/profile/01416044052053974523</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-459458859817042968.post-4765986808217488561</id><published>2008-06-03T11:58:00.000-07:00</published><updated>2008-06-03T11:59:59.909-07:00</updated><title type='text'>Don't Let Architecture Astronauts Scare You</title><content type='html'>Check what Joel says about &lt;a href="http://www.joelonsoftware.com/articles/fog0000000018.html"&gt;Architecture Astronauts&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='http://res1.blogblog.com/tracker/459458859817042968-4765986808217488561?l=www.kalantarian.org%2Fartak%2Ftechblog'/&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/4765986808217488561/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='https://www.blogger.com/comment.g?blogID=459458859817042968&amp;postID=4765986808217488561' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/posts/default/4765986808217488561'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/459458859817042968/posts/default/4765986808217488561'/><link rel='alternate' type='text/html' href='http://www.kalantarian.org/artak/techblog/2008/06/dont-let-architecture-astronauts-scare.html' title='Don&apos;t Let Architecture Astronauts Scare You'/><author><name>Artak</name><uri>http://www.blogger.com/profile/01416044052053974523</uri><email>noreply@blogger.com</email></author><thr:total xmlns:thr='http://purl.org/syndication/thread/1.0'>0</thr:total></entry></feed>
