<?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/'><id>tag:blogger.com,1999:blog-6800934446457898793.post656325068512394681..comments</id><updated>2010-07-04T08:51:33.462-04:00</updated><category term='trueskill'/><category term='aes'/><title type='text'>Comments on Moserware: For Loops: Using i++, ++i, Enumerators, or None of...</title><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.moserware.com/feeds/656325068512394681/comments/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html'/><author><name>Jeff Moser</name><uri>http://www.blogger.com/profile/16074905903060665396</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_Zfbv3mHcYrc/SLDM--5fn8I/AAAAAAAAA1w/EZtLwWvYhdI/S220/facebook+beard2.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-4675945769946277365</id><published>2008-05-30T20:49:00.000-04:00</published><updated>2008-05-30T20:49:00.000-04:00</updated><title type='text'>&lt;b&gt;Kevin&lt;/b&gt;: Interesting observation ; I hadn't c...</title><content type='html'>&lt;B&gt;Kevin&lt;/B&gt;: Interesting observation ; I hadn't considered that path. I think a lot of it was influenced by examples, but it could cause a subconscious preference.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/4675945769946277365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/4675945769946277365'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1212194940000#c4675945769946277365' title=''/><author><name>Jeff Moser</name><uri>http://www.blogger.com/profile/16074905903060665396</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-252333216'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-1020798185389254805</id><published>2008-05-30T12:08:00.000-04:00</published><updated>2008-05-30T12:08:00.000-04:00</updated><title type='text'>A thought: programmers are probably drawn to postf...</title><content type='html'>A thought: programmers are probably drawn to postfix notation because by definition, the name C++ is itself postfix?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/1020798185389254805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/1020798185389254805'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1212163680000#c1020798185389254805' title=''/><author><name>Kevin</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1637684318'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-2779055117205321581</id><published>2008-02-07T20:30:00.000-05:00</published><updated>2008-02-07T20:30:00.000-05:00</updated><title type='text'>Mike: thanks for the follow-up response. Your poin...</title><content type='html'>Mike: thanks for the follow-up response. Your points are well taken. &lt;BR/&gt;&lt;BR/&gt;I think that every language has to make decisions on several areas like syntax, expressiveness, raw power, and what it will protect you from. &lt;BR/&gt;&lt;BR/&gt;I think it's clear that Bjarne choose to write as think of a layer on top of C that would give the majority of OO ideas. To him, I think performance was paramount like you mentioned.&lt;BR/&gt;&lt;BR/&gt;I also think that people write in C++ now since it's the language of their legacy codebase that companies have spent an enormous amount of time creating. (If MS Office was greenfield now, it'd probably be written in C#). The other reason is for cross-platform programs that need good performance. (This will likely become more negligible as the CLR and JVM continue to expand)&lt;BR/&gt;&lt;BR/&gt;However, when they do write in C++, it would be silly to ignore libraries like Boost and ACE that implement a lot of low level stuff for you. By the time you resolve to use smart pointers and structured exception handling, no one is worried excessively on the copy constructor that's wasted.&lt;BR/&gt;&lt;BR/&gt;Still, you made good points. Some places are going to demand perf above all else. That's why I have to acknowledge that it might be worth the battle to fight for unilateral ++i syntax as a coding standard if you're in a pure C++ shop.&lt;BR/&gt;&lt;BR/&gt;However, for the vast majority of cases, readability and maintainability is a trump card. As we move into the dynamic language and functional paradigms more, people will drift away from for loops altogether and start to think more and more in terms of things like Count() and higher order functions like map and reduce.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/2779055117205321581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/2779055117205321581'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202434200000#c2779055117205321581' title=''/><author><name>Jeff Moser</name><uri>http://www.blogger.com/profile/16074905903060665396</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-252333216'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-6527536410491967957</id><published>2008-02-07T17:20:00.000-05:00</published><updated>2008-02-07T17:20:00.000-05:00</updated><title type='text'>Jeff,&lt;br&gt;Sorry for the nitpick.  Your illustration...</title><content type='html'>Jeff,&lt;BR/&gt;Sorry for the nitpick.  Your illustration of C++ pre vs post increment was perfect but I didn't think it was clear that STL iterators are implemented by overloading the increment operators.  But you clearly pointed out the STL iterators are coded in a way that conforms to the semantics of those operators.  Any class that overloads the post-increment operator in C++ must return a copy-constructed version of itself which could be a performance hit if the class held enough data.  &lt;BR/&gt;Of course the performance hit is negligible. If you are required to program in C++ it is typically because you are coding a performance sensitive capability and ignoring even modest opportunities to improve performance just seems wrong.  &lt;BR/&gt;Otherwise, this entry is probably the best I have seen from somebody I personally know.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/6527536410491967957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/6527536410491967957'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202422800000#c6527536410491967957' title=''/><author><name>Mike Petry</name><uri>http://www.blogger.com/profile/00900707625184132791</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-894030316'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-7219454735181823943</id><published>2008-02-04T22:57:00.000-05:00</published><updated>2008-02-04T22:57:00.000-05:00</updated><title type='text'>Mike: Glad you liked it!&lt;br&gt;&lt;br&gt;Bart: foreach does...</title><content type='html'>Mike: Glad you liked it!&lt;BR/&gt;&lt;BR/&gt;Bart: foreach does create an enumerator object, but it's very fast since it's going to use generation 0 memory (quick birth, quick death)&lt;BR/&gt;&lt;BR/&gt;The for(..;..;..) method really requires, like you say, that the underlying data structure has array like semantics rather than linked-list semantics.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/7219454735181823943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/7219454735181823943'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202183820000#c7219454735181823943' title=''/><author><name>Jeff Moser</name><uri>http://www.blogger.com/profile/16074905903060665396</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-252333216'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-7722410064185552605</id><published>2008-02-04T14:39:00.000-05:00</published><updated>2008-02-04T14:39:00.000-05:00</updated><title type='text'>Nice article.  &lt;br&gt;&lt;br&gt;However, I would add that f...</title><content type='html'>Nice article.  &lt;BR/&gt;&lt;BR/&gt;However, I would add that foreach is also avoided when doing programming games in managed C#.  It leaves behind objects that need to be GC'ed :)&lt;BR/&gt;&lt;BR/&gt;Having said that the for loop is not faster all the time!  Check out this link (guy who created MDX) where in SSAS 2005 the dvelopers  screwed up in the implementation of iterators/enumerators...foreach is exponentially faster:&lt;BR/&gt;http://sqljunkies.com/WebLog/mosha/archive/2007/04/19/stored_procs_best_practices.aspx&lt;BR/&gt;&lt;BR/&gt;It alawys goes back to that rule: "It Depends" :)</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/7722410064185552605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/7722410064185552605'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202153940000#c7722410064185552605' title=''/><author><name>Bart Czernicki</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-831789245'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-6484528135827052462</id><published>2008-02-04T12:38:00.000-05:00</published><updated>2008-02-04T12:38:00.000-05:00</updated><title type='text'>Nice article Jeff. Appreciate the insights.</title><content type='html'>Nice article Jeff. Appreciate the insights.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/6484528135827052462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/6484528135827052462'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202146680000#c6484528135827052462' title=''/><author><name>Mike</name><uri>http://www.blogger.com/profile/10903880768750599460</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-316213811'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-1241700460919949807</id><published>2008-02-03T07:20:00.000-05:00</published><updated>2008-02-03T07:20:00.000-05:00</updated><title type='text'>Anonymous: do &lt;i&gt;what&lt;/i&gt; in C? What exactly are y...</title><content type='html'>Anonymous: do &lt;I&gt;what&lt;/I&gt; in C? What exactly are you dumbfounded by?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/1241700460919949807'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/1241700460919949807'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202041200000#c1241700460919949807' title=''/><author><name>Jeff Moser</name><uri>http://www.blogger.com/profile/16074905903060665396</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-252333216'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-8922090137857563591</id><published>2008-02-03T07:19:00.000-05:00</published><updated>2008-02-03T07:19:00.000-05:00</updated><title type='text'>Paolo: thanks for the insight! I had a hunch that ...</title><content type='html'>Paolo: thanks for the insight! I had a hunch that it might have had to deal with that I,J, and K are used for vectors in physics. However, I didn't find any reference to this in my limited research.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/8922090137857563591'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/8922090137857563591'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202041140000#c8922090137857563591' title=''/><author><name>Jeff Moser</name><uri>http://www.blogger.com/profile/16074905903060665396</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-252333216'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-3507787044539443252</id><published>2008-02-03T07:17:00.000-05:00</published><updated>2008-02-03T07:17:00.000-05:00</updated><title type='text'>Robert: Interesting views on aesthetics. I would h...</title><content type='html'>Robert: Interesting views on aesthetics. I would have thought that i++ would look better since everything else starts with a letter (i =; i &lt;; i..) and you'd have more balance, but I can also see your point.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/3507787044539443252'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/3507787044539443252'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202041020000#c3507787044539443252' title=''/><author><name>Jeff Moser</name><uri>http://www.blogger.com/profile/16074905903060665396</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-252333216'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-8881822930187833972</id><published>2008-02-03T06:31:00.000-05:00</published><updated>2008-02-03T06:31:00.000-05:00</updated><title type='text'>This is so funny...&lt;br&gt;&lt;br&gt;I guess you can't do th...</title><content type='html'>This is so funny...&lt;BR/&gt;&lt;BR/&gt;I guess you can't do that in C either?&lt;BR/&gt;&lt;BR/&gt;I'm just dumbfounded by this whole blog.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/8881822930187833972'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/8881822930187833972'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202038260000#c8881822930187833972' title=''/><author><name>Anonymous</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-325415001'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-8042839418035638601</id><published>2008-02-03T04:21:00.000-05:00</published><updated>2008-02-03T04:21:00.000-05:00</updated><title type='text'>The reason why IJKLMN were used for integer variab...</title><content type='html'>The reason why IJKLMN were used for integer variables in Fortran, by the way, is that those were used often as indexes or sizes (both of which are integers) in math.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/8042839418035638601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/8042839418035638601'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202030460000#c8042839418035638601' title=''/><author><name>Paolo Bonzini</name><uri>http://www.blogger.com/profile/13626037576749368651</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-622488188'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-7004341529573634736</id><published>2008-02-03T02:36:00.000-05:00</published><updated>2008-02-03T02:36:00.000-05:00</updated><title type='text'>I've stuck to pre-increment simply on aesthetic gr...</title><content type='html'>I've stuck to pre-increment simply on aesthetic grounds: I dislike seeing the ++ immediately next to a close parenthesis.&lt;BR/&gt;&lt;BR/&gt;However, I would point out that in general making such decisions based on a hazy idea of what might be faster is farcical (and unfortunately common). Optimization is not optimization without cold hard data: measure the speed.&lt;BR/&gt;&lt;BR/&gt;For typical tight inner loops, anyhow, the code for incrementing is probably nowhere near as important as memory access concerns---e.g. setting up cache prefetches. Which of course, and very frustatingly, we don't yet have much control over in languages above assembly: I find it amazing that something so critical to performance is still left  up to hoping for compiler magic or weird non-portable hacks.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/7004341529573634736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/7004341529573634736'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202024160000#c7004341529573634736' title=''/><author><name>robert</name><uri>http://www.blogger.com/profile/02285636896312756581</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-1017032269'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-7787165798470975928</id><published>2008-02-02T22:23:00.000-05:00</published><updated>2008-02-02T22:23:00.000-05:00</updated><title type='text'>Mike:&lt;br&gt;&lt;br&gt;C# &lt;a href="http://msdn2.microsoft.co...</title><content type='html'>Mike:&lt;BR/&gt;&lt;BR/&gt;C# &lt;A HREF="http://msdn2.microsoft.com/en-us/library/8edha89s.aspx" REL="nofollow"&gt;supports operator overloading for some operators&lt;/A&gt;, but not for ++. &lt;BR/&gt;&lt;BR/&gt;In addition, I think that C# was influenced by having to design features that would play nice with features available in a vast amount of other languages that ride on the CLR. This is what probably led to the push towards an interface/Enumerator based approach.&lt;BR/&gt;&lt;BR/&gt;&lt;A HREF="http://msdn2.microsoft.com/en-us/library/system.collections.ienumerable.aspx" REL="nofollow"&gt;IEnumerable&lt;/A&gt; is a very powerful interface and indeed is what &lt;A HREF="http://msdn2.microsoft.com/en-us/library/bb397919.aspx" REL="nofollow"&gt;LINQ to Objects&lt;/A&gt; is built on. &lt;BR/&gt;&lt;BR/&gt;Having the clear semantics that IEnumerable has made LINQ possible.&lt;BR/&gt;&lt;BR/&gt;Maybe I misunderstood your comment?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/7787165798470975928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/7787165798470975928'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202008980000#c7787165798470975928' title=''/><author><name>Jeff Moser</name><uri>http://www.blogger.com/profile/16074905903060665396</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-252333216'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-3802466075157717694</id><published>2008-02-02T22:13:00.000-05:00</published><updated>2008-02-02T22:13:00.000-05:00</updated><title type='text'>Cool post, I ran across it on the front page of pr...</title><content type='html'>Cool post, I ran across it on the front page of programming.reddit.  &lt;BR/&gt;&lt;BR/&gt;One needs to look a bit deeper at the   C++ pre/postfix unary operator.  The main point is that C++ supports operator overloading.  There are semantical differences between the two operators (as you described very lucidly).  Languages such a C# and Java do not support operator overloading.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/3802466075157717694'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/3802466075157717694'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202008380000#c3802466075157717694' title=''/><author><name>Mike Petry</name><uri>http://www.blogger.com/profile/00900707625184132791</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-894030316'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-341469352049948495</id><published>2008-02-02T20:17:00.000-05:00</published><updated>2008-02-02T20:17:00.000-05:00</updated><title type='text'>Eelis: interesting thoughts. It's sort of a shame ...</title><content type='html'>Eelis: interesting thoughts. It's sort of a shame from a language perspective that new programmers need to be concerned about such details. &lt;BR/&gt;&lt;BR/&gt;However, I agree that it would help better inform the programmer if it caused him/her to investigate the issue more.&lt;BR/&gt;&lt;BR/&gt;I also agree that it probably wasn't given much thought at the start and that has just grown (in non-thought that is) as the years have gone by. &lt;BR/&gt;&lt;BR/&gt;For C++ code, I'm still undecided if I would make the push for preincrement notation since it would make the overall codebase more uniform because the preferred syntax for iterators would be preincrement. &lt;BR/&gt;&lt;BR/&gt;For C#, what I work in the most at the moment, it doesn't matter nearly as much and that's why I'm leaning to favoring the community trend of postincrement.&lt;BR/&gt;&lt;BR/&gt;Regardless, it's an interesting to find what's most elegant from a technical, community, and common sense perspective on the issue.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/341469352049948495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/341469352049948495'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202001420000#c341469352049948495' title=''/><author><name>Jeff Moser</name><uri>http://www.blogger.com/profile/16074905903060665396</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-252333216'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-1871629340722244950</id><published>2008-02-02T20:06:00.000-05:00</published><updated>2008-02-02T20:06:00.000-05:00</updated><title type='text'>Jeff:&lt;br&gt;&lt;br&gt;I agree that working with inexperienc...</title><content type='html'>Jeff:&lt;BR/&gt;&lt;BR/&gt;I agree that working with inexperienced programmers in a crappy codebase can often be a very strong argument for choosing solutions that would be frowned upon by more experienced programmers working in a clean codebase. However, I don't consider this one of those cases.&lt;BR/&gt;&lt;BR/&gt;If a programmer sees prefix increment where he would have expected postfix increment because he doesn't know any better, what's the worst that can happen? Either he will ignore it, or he will decide to investigate, learn the difference, and end up a more informed programmer who has now seen another demonstration of the KISS principle.&lt;BR/&gt;&lt;BR/&gt;As for "popularity", I highly doubt it was ever a very conscious thing, let alone active enthusiasm. Most likely neither the first needless-postfix users nor their countless imitators gave it any thought at all.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/1871629340722244950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/1871629340722244950'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1202000760000#c1871629340722244950' title=''/><author><name>Eelis</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-232423653'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-4372291024735855240</id><published>2008-02-02T19:44:00.000-05:00</published><updated>2008-02-02T19:44:00.000-05:00</updated><title type='text'>Eelis: Thanks for sharing the comment.&lt;br&gt;&lt;br&gt;I ab...</title><content type='html'>Eelis: Thanks for sharing the comment.&lt;BR/&gt;&lt;BR/&gt;I absolutely agree that pre-increment semantics are better. I want to use pre-increments from a technical perspective. &lt;BR/&gt;&lt;BR/&gt;It's just that in C# at least, it makes no difference in the case I mentioned. Since pre-increment goes against the norm, it would just serve to make the code-base on a large project less uniform. &lt;BR/&gt;&lt;BR/&gt;So, althought it is better from an imperative purity perspective, I am bound from a practical aspect to go with post-increment since consistency and readability are higher priorities.&lt;BR/&gt;&lt;BR/&gt;Any thoughts on why post-increment became so popular even before objects?</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/4372291024735855240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/4372291024735855240'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1201999440000#c4372291024735855240' title=''/><author><name>Jeff Moser</name><uri>http://www.blogger.com/profile/16074905903060665396</uri><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-252333216'/></entry><entry><id>tag:blogger.com,1999:blog-6800934446457898793.post-1440312482807863655</id><published>2008-02-02T19:39:00.000-05:00</published><updated>2008-02-02T19:39:00.000-05:00</updated><title type='text'>(In what follows I'll only talk about C++, because...</title><content type='html'>(In what follows I'll only talk about C++, because I know nothing about C# and Java and whatnot.)&lt;BR/&gt;&lt;BR/&gt;The efficiency argument against i++ vs ++i is indeed very weak. However, there is a stronger argument.&lt;BR/&gt;&lt;BR/&gt;Postfix increment (which makes a copy of the argument, increments the argument, and then returns the copy) has more complex semantics than prefix increment (which just increments the argument and returns it). This is not an implementation issue; we're talking about the semantics specified by the language  definition. With this observation, the well known KISS principle is directly applicable: postfix increment's more complex semantics don't win one anything, so prefer the simpler prefix increment solution.&lt;BR/&gt;&lt;BR/&gt;Note that the argument applies not only when i happens to be a C++ iterator, but also when it is an int.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/1440312482807863655'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6800934446457898793/656325068512394681/comments/default/1440312482807863655'/><link rel='alternate' type='text/html' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html?showComment=1201999140000#c1440312482807863655' title=''/><author><name>Eelis</name><email>noreply@blogger.com</email><gd:image xmlns:gd='http://schemas.google.com/g/2005' rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img1.blogblog.com/img/blank.gif'/></author><thr:in-reply-to xmlns:thr='http://purl.org/syndication/thread/1.0' href='http://www.moserware.com/2008/02/for-loops-using-i-i-enumerators-or-none.html' ref='tag:blogger.com,1999:blog-6800934446457898793.post-656325068512394681' source='http://www.blogger.com/feeds/6800934446457898793/posts/default/656325068512394681' type='text/html'/><gd:extendedProperty xmlns:gd='http://schemas.google.com/g/2005' name='blogger.itemClass' value='pid-304513808'/></entry></feed>
