Skip navigation.
 
mlRe: Style Question: apology and correction
FROM : Rob Ross
DATE : Mon Jun 30 23:22:20 2008

On Jun 27, 2008, at 10:25 PM, Jens Alfke wrote:

>
> On 27 Jun '08, at 9:45 PM, Rob Ross wrote:
>

>> Btw, how many people realize this convention comes from the early 
>> K&R C book, and the *only* reason they wrote it this way was to 
>> minimize the number of lines of text their examples would take up 
>> on each page? It's a type-setting design decision, and has nothing 
>> to do with how "pure" a programmer you are.

>
> Do you have any citation that shows that was their rationale? From 
> the forward of K&R:
>

>> "The position of braces is less important, although people hold 
>> passionate beliefs. We have chosen one of several popular styles. 
>> Pick a style that suits you, then use it consistently."

>
> Ergo, it was already a popular coding style in 1978. Understandably 
> so, as a standard terminal fit even fewer lines (only 24) than did 
> a page of print, so minimizing the number of lines was important in 
> those days if you wanted to be able to see any amount of your code 
> at a time.
>
> —Jens [who learned C in 1980 using K&R 1st ed. and a VT-100]


I stand humbly corrected. I fell victim to reporting something I read 
"on the internet" as fact without checking for sources.

I had seen several people whom I respected mention the theory of the 
book publisher as driving the use of a particular style in the 
original K&R "The C Programming Language" book, and have been 
repeating this as fact. But after your email challenging me to find 
sources, I could not do so after several hours of searching.

So I contacted the sources - both K&R, and to my amazement received 
email replies from both of them. They stated they had never advocated 
for any particular style, and that it was better just to be 
consistent with whatever one chose. And their use of the K&R style 
was well established by Ken Thompson, and something all the members 
of the original Unix and C compiler teams adopted, and still use to 
this day. So the use in the book of the K&R style represented what 
they themselves used on a daily basis.

So please accept my apology for propagating another internet rumor. 
We programmers really need something like snopes.com for programming 
myths :)

Rob Ross, Lead Software Engineer
E! Networks

---------------------------------------------------
"Beware of he who would deny you access to information, for in his 
heart he dreams himself your master." -- Commissioner Pravin Lal

Related mailsAuthorDate
mlStyle Question Alex Wait Jun 28, 06:30
mlRe: Style Question Shawn Erickson Jun 28, 06:40
mlRe: Style Question Alex Wait Jun 28, 06:44
mlRe: Style Question Rob Ross Jun 28, 06:45
mlRe: Style Question Shawn Erickson Jun 28, 06:49
mlRe: Style Question Jens Alfke Jun 28, 07:13
mlRe: Style Question Alex Wait Jun 28, 07:15
mlRe: Style Question Jens Alfke Jun 28, 07:25
mlRe: Style Question Robert Claeson Jun 28, 10:54
mlRe: Style Question Sam Mo Jun 28, 15:39
mlRe: Style Question Rob Ross Jun 28, 16:27
mlRe: Style Question Hamish Allan Jun 29, 13:43
ml[OT] Re: Style Question Steve Byan Jun 30, 18:33
mlRe: Style Question: apology and correction Rob Ross Jun 30, 23:22