<story><title>How Old School C Programmers Process Arguments</title><url>http://www.usrsb.in/How-Old-School-C-Programmers-Process-Arguments.html</url></story><parent_chain><item><author>tomsmeding</author><text>I have to say, to reasonably experienced C programmers, this code should be pretty clear. If you need that whole paragraph to understand (* ++argv)[0], you might be an awesome programmer, but you&amp;#x27;re not yet a reasonably experienced C programmer. ;)&lt;p&gt;I do think this is even more concise than they would have written in maintained code. In particular, I believe the missing {}&amp;#x27;s for the &amp;#x27;while&amp;#x27; and &amp;#x27;for&amp;#x27; loops whouldn&amp;#x27;t have been left away, but I might be mistaken. Compare, for example, with this gem:&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.cs.princeton.edu&amp;#x2F;courses&amp;#x2F;archive&amp;#x2F;spr09&amp;#x2F;cos333&amp;#x2F;beautiful.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.cs.princeton.edu&amp;#x2F;courses&amp;#x2F;archive&amp;#x2F;spr09&amp;#x2F;cos333&amp;#x2F;be...&lt;/a&gt; (submitted as &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;news.ycombinator.com&amp;#x2F;item?id=5672875&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;news.ycombinator.com&amp;#x2F;item?id=5672875&lt;/a&gt; some time ago)&lt;p&gt;There Kernighan talks about a piece of code written by Rob Pike for inclusion in a different book; the code was written to be as small as possible while still including some useful functionality. In particular, Pike made well-considered choices about which functionality to include and which to exclude, but there are also some of those expressions that will not be completely transparent to the beginner C programmer. But the goal was writing &lt;i&gt;short&lt;/i&gt; code, and &lt;i&gt;clarity&lt;/i&gt; came secondary, but also emerged partly as a result of the first.</text></item></parent_chain><comment><author>bsder</author><text>&amp;gt; If you need that whole paragraph to understand (* ++argv)[0], you might be an awesome programmer, but you&amp;#x27;re not yet a reasonably experienced C programmer. ;)&lt;p&gt;Lines like that have far too much information density for my old brain, anymore.&lt;p&gt;Things that went through my poor brain: &amp;quot;Why pre-inc&amp;#x2F;decrement? Why the +1 on the for?  Did he actually get the precedence of the operators correct?  Okay, it looks like argc and argv will be mangled if you actually want to do anything else with them.  I see comparing to &amp;#x27;\0&amp;#x27; with no count limit--is there a buffer overrun lurking here?.  Does that error handling actually work--that loop can&amp;#x27;t exit with that condition unless the second clause does something.&lt;p&gt;And that was like--30 seconds?&lt;p&gt;I&amp;#x27;d assign argc and argv to something else so if I need them later for something they are in their original state.  I&amp;#x27;d give myself a variable that points to each individual argv on each iteration, and I&amp;#x27;d call it something.  I&amp;#x27;d make the error handling more explicit so if I had to add another case later I wouldn&amp;#x27;t have to rack my brain about whether the error gets handled.  Etc.&lt;p&gt;Apparently I&amp;#x27;ve become an inflexible, washed-up, old fart because I just don&amp;#x27;t enjoy writing C code with that kind of puzzle-like quality anymore.</text></comment>
<story><title>How Old School C Programmers Process Arguments</title><url>http://www.usrsb.in/How-Old-School-C-Programmers-Process-Arguments.html</url></story><parent_chain><item><author>tomsmeding</author><text>I have to say, to reasonably experienced C programmers, this code should be pretty clear. If you need that whole paragraph to understand (* ++argv)[0], you might be an awesome programmer, but you&amp;#x27;re not yet a reasonably experienced C programmer. ;)&lt;p&gt;I do think this is even more concise than they would have written in maintained code. In particular, I believe the missing {}&amp;#x27;s for the &amp;#x27;while&amp;#x27; and &amp;#x27;for&amp;#x27; loops whouldn&amp;#x27;t have been left away, but I might be mistaken. Compare, for example, with this gem:&lt;p&gt;&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.cs.princeton.edu&amp;#x2F;courses&amp;#x2F;archive&amp;#x2F;spr09&amp;#x2F;cos333&amp;#x2F;beautiful.html&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.cs.princeton.edu&amp;#x2F;courses&amp;#x2F;archive&amp;#x2F;spr09&amp;#x2F;cos333&amp;#x2F;be...&lt;/a&gt; (submitted as &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;news.ycombinator.com&amp;#x2F;item?id=5672875&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;news.ycombinator.com&amp;#x2F;item?id=5672875&lt;/a&gt; some time ago)&lt;p&gt;There Kernighan talks about a piece of code written by Rob Pike for inclusion in a different book; the code was written to be as small as possible while still including some useful functionality. In particular, Pike made well-considered choices about which functionality to include and which to exclude, but there are also some of those expressions that will not be completely transparent to the beginner C programmer. But the goal was writing &lt;i&gt;short&lt;/i&gt; code, and &lt;i&gt;clarity&lt;/i&gt; came secondary, but also emerged partly as a result of the first.</text></item></parent_chain><comment><author>vultour</author><text>I am not a C programmer, nor a veteran in any other language and this code was pretty clear.</text></comment>