<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/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>What does style look like, part 2</title><link>http://blogs.msdn.com/larryosterman/archive/2004/11/10/255225.aspx</link><description>In my previous style post , I took a piece of code from Robert Sedgewicks algorithms book, and "Hungarian-ized" it. The routine currently looks like: #include "list.h" main(C cArg, SZ rgszArg[]) { I iNode, cNodes = atoi(rgszArg[1]), cNodesToSkip = atoi(rgszArg[2]);</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: What does style look like, part 2</title><link>http://blogs.msdn.com/larryosterman/archive/2004/11/10/255225.aspx#255299</link><pubDate>Wed, 10 Nov 2004 21:31:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:255299</guid><dc:creator>Jerry Pisk</dc:creator><description>Why does everybody like to put the block opening brace on the same line as the parent statement?</description></item><item><title>re: What does style look like, part 2</title><link>http://blogs.msdn.com/larryosterman/archive/2004/11/10/255225.aspx#255307</link><pubDate>Wed, 10 Nov 2004 21:36:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:255307</guid><dc:creator>Larry Osterman</dc:creator><description>Because K&amp;amp;R did it that way.&lt;br&gt;&lt;br&gt;Personally I don't prefer that style, but it IS a valid coding style.&lt;br&gt;&lt;br&gt;And this series isn't about what's good or bad (or at least I'm trying not to let my personal feelings leak into the debate).&lt;br&gt;</description></item><item><title>re: What does style look like, part 2</title><link>http://blogs.msdn.com/larryosterman/archive/2004/11/10/255225.aspx#255319</link><pubDate>Wed, 10 Nov 2004 22:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:255319</guid><dc:creator>James H.</dc:creator><description>At the risk of exposing my total and utter newbness to coding, who/what is K&amp;amp;R?</description></item><item><title>re: What does style look like, part 2</title><link>http://blogs.msdn.com/larryosterman/archive/2004/11/10/255225.aspx#255324</link><pubDate>Wed, 10 Nov 2004 21:59:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:255324</guid><dc:creator>Larry Osterman</dc:creator><description>Whoops!  That's a really good point James.&lt;br&gt;&lt;br&gt;K&amp;amp;R is &amp;quot;The C Programming Language&amp;quot; by Kernighan and Ritchie (thus K&amp;amp;R).  This is the original reference manual for C programming, many (most?) of the first several generations of programmers learned C from that book.&lt;br&gt;</description></item><item><title>re: What does style look like, part 2</title><link>http://blogs.msdn.com/larryosterman/archive/2004/11/10/255225.aspx#255374</link><pubDate>Wed, 10 Nov 2004 23:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:255374</guid><dc:creator>Steven C.</dc:creator><description>Another thing to throw into the mix - add braces to all single line blocks which are not already braced (such as the for loop inside the while loop). &lt;br&gt;&lt;br&gt;Okay, maybe that's just me. :P</description></item><item><title>re: What does style look like, part 2</title><link>http://blogs.msdn.com/larryosterman/archive/2004/11/10/255225.aspx#255376</link><pubDate>Wed, 10 Nov 2004 23:29:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:255376</guid><dc:creator>Larry Osterman</dc:creator><description>Steven, that variant comes in tomorrow :)&lt;br&gt;</description></item><item><title>re: What does style look like, part 2</title><link>http://blogs.msdn.com/larryosterman/archive/2004/11/10/255225.aspx#255462</link><pubDate>Thu, 11 Nov 2004 02:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:255462</guid><dc:creator>Norman Diamond</dc:creator><description>Another thing to throw into the mix:  along with putting each executable statement on its own line, also put each declarator into its own declaration (thereby resembling a statement) and put it on its own line.&lt;br&gt;&lt;br&gt;If K&amp;amp;R indented 4 columns at a time, was that just because of book typography or did they do it in their real code?  I'd have thought they were using DEC terminals[*] along with their DEC CPUs even though they didn't like DEC's operating systems, and I'm pretty sure those terminals already had built-in tabbing to multiples of 8 columns.&lt;br&gt;&lt;br&gt;[* at least when they weren't using ASR/33 Teletypes]</description></item><item><title>re: What does style look like, part 2</title><link>http://blogs.msdn.com/larryosterman/archive/2004/11/10/255225.aspx#255486</link><pubDate>Thu, 11 Nov 2004 04:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:255486</guid><dc:creator>Larry Osterman</dc:creator><description>I don't know why K&amp;amp;R used their style, it's an interesting question.&lt;br&gt;</description></item><item><title>re: What does style look like, part 2</title><link>http://blogs.msdn.com/larryosterman/archive/2004/11/10/255225.aspx#255495</link><pubDate>Thu, 11 Nov 2004 04:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:255495</guid><dc:creator>Michael Grier [MSFT]</dc:creator><description>Usual answer is that the OTBS (One True Brace Style a/k/a K&amp;amp;R) is to preserve vertical whitespace.  This matters when you're on a 24x80 video terminal, and in email for that matter.&lt;br&gt;&lt;br&gt;I'm an aligned bracer myself.  Against my better judgement, people have convinced me that the braces should not be indented, but code snippets in manuals or email are longer when you use this format (indented or not).&lt;br&gt;</description></item><item><title>re: What does style look like, part 2</title><link>http://blogs.msdn.com/larryosterman/archive/2004/11/10/255225.aspx#255520</link><pubDate>Thu, 11 Nov 2004 05:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:255520</guid><dc:creator>Nicholas Allen</dc:creator><description>Larry, where did you get your K&amp;amp;R style from?  I'm looking at my copy of K&amp;amp;R (1978 edition) and they used a 5 character indent and put the braces for function definitions on a line by themselves.  The example for file copying on page 14 looks like&lt;br&gt;&lt;br&gt;main()&lt;br&gt;{&lt;br&gt;.....int c;&lt;br&gt;&lt;br&gt;.....c = getchar();&lt;br&gt;.....while (c != EOF) {&lt;br&gt;..........putchar(c);&lt;br&gt;..........c = getchar();&lt;br&gt;.....}&lt;br&gt;}</description></item><item><title>re: What does style look like, part 2</title><link>http://blogs.msdn.com/larryosterman/archive/2004/11/10/255225.aspx#255524</link><pubDate>Thu, 11 Nov 2004 06:03:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:255524</guid><dc:creator>Larry Osterman</dc:creator><description>Nicholas, my bad - I miscounted (I'm so used to 4 space tabs).&lt;br&gt;&lt;br&gt;And you're right about the function brace, my bad too.&lt;br&gt;</description></item><item><title>re: What does style look like, part 2</title><link>http://blogs.msdn.com/larryosterman/archive/2004/11/10/255225.aspx#255690</link><pubDate>Thu, 11 Nov 2004 15:47:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:255690</guid><dc:creator>Michael</dc:creator><description>I actually worked around &amp;quot;K&amp;amp;R&amp;quot; for a while.  Everyone around there put their braces on the same line...</description></item><item><title>Geek Noise 2004-11-28</title><link>http://blogs.msdn.com/larryosterman/archive/2004/11/10/255225.aspx#271914</link><pubDate>Tue, 30 Nov 2004 02:17:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:271914</guid><dc:creator>Geek Noise</dc:creator><description /></item></channel></rss>