lkml.org 
[lkml]   [1996]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Coding style?

On Thu, 5 Dec 1996, Andrew E. Mileski wrote:

>
> > > There is no standard, and Linus has said he will not impose his > >
> preferences on developers.

In a previous life......
One of my students discovered that 'C' didn't care about
line feeds so after a few months his work became unreadable.
Then one of my students discovered that 'C' didn't care
about white space so after a few months his work, too,
became unreadable.

Therefore I made some rules. They were not bad rules nor
were they good rules. They were just rules. The rules were
based upon the premise that Software is not an art-form, nor
is it something designed to be fed through a Compiler as
rapidly as possible.

Instead, Software is a human-readable description of how to
run a machine.

We have come a long way. The first Software I wrote looked
like this:
377
205
173
212

Even that had rules. It had to be indented exactly 1 tab-
character from the first column. Anything in the first
column told the assembler to ignore the whole line. This is
how we made "comments". Also, any rub-out character anywhere
on the line, told the assembler to ignore that line also.
This is how we corrected typos when using a 1200 baud
teletype to enter the source-code.

Once "high level" languages such as COBOL, FORTRAN, Pascal,
and others became commonplace the idea of "coding style"
somehow became part of Software.

I have never been able to figure that out. Early coding was
performed by mathematicians, scientists, and engineers. Now
we have artists.

By current standards, much of Linux software is very
readable. It is therefore, the way it should be. Anything
that detracts from its readability reduces the value of the
software. We all have likes and dislikes. Few would like the
rigorous software format imposed upon many in the workplace
that have to deal will FDA and DOD Certification. Therefore
I won't burden anyone with such.

However, at Analogic, we have much of our CAT-Scanner
Software written in Russia. When you look at the source, you
can't tell that it's written in Russia because we all use
the same rules.
A trivial example, all infinite loops are written in 'C' as:

for(;;)
Never
while(1)
One is not better than the other. The Compiler certainly
knows what you want to do. It will not generate any extra
code by checking some register against a value. It will just
jump back to some previous address and do the same thing
over again. The rules allow me to look at someone else's
code and find why it didn't perform as expected. I don't
have to spend any time getting used to someone's style in
order to trace the logic.

I think someone should find the de-facto coding rules that
are presently in use in the Linux source and write them
down. A start has been made in the Documentation tree. The
rules should be then read and adjusted by the gurus that are
working on the Linux source, and then they should become the
law.


Cheers,
Dick Johnson
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Richard B. Johnson
Project Engineer
Analogic Corporation
Voice : (508) 977-3000 ext. 3754
Fax : (508) 532-6097
Modem : (508) 977-6870
Ftp : ftp@boneserver.analogic.com
Email : rjohnson@analogic.com, johnson@analogic.com
Penguin : Linux version 2.1.13 on an i586 machine.
Warning : It's hard to remain at the trailing edge of technology.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-


\
 
 \ /
  Last update: 2005-03-22 13:38    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site