[Expat-discuss] Coding style in Expat

Fred L. Drake, Jr. fdrake@acm.org
Sat Jun 15 09:23:02 2002


There have been some emails on the expat-checkins list regarding the
coding style in Expat.  I've not actually received them all since
SourceForge's mail systems seem severely overloaded and has not been
delivering email in a timely manner (I've seen as much as a 4 day
delay).

Anyway, here are my comments on the coding style.

The Expat code base exhibits signs of coding style inconsistency,
possibly because additional people have taken over maintaining it
since James Clark wrote the original code, and don't feel comfortable
with his style.

The original style uses 2-space indentation levels with leading hard
tabs which represent 8 columns each.  The hard tabs definately cause
code to look funny for people whose editors are configured to show
tabs as 4 columns, causing a weird "reverse indentation" appearance in
some cases.

Solving the reverse indentation problem can be accomplished by
converting the code style to use only spaces and no tabs; this should
be done just before the 1.95.4 release.

The two-space indentation can be difficult to read as well, but it's
less clear that a change is actually required.

My personal preference would be to use a 4 space indent, but the Expat
code is already rife with long lines and deep nesting.  It's not clear
that changing the 2 space indents is worth the pain.  (See the .c
files in the tests/ directory for examples of my preferred C style.)


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation