Mark Atwood <[email protected]>:
> Did Dr Mills have a preferred C style?  If he did, was it not terrible?

It's in devel/dot.emacs.  The codebase is in fact almost entirely formatted
this way; I've been careful to preserve that despite personally having
different preferences.

;; This is how Dave Mills likes to see the NTP code formatted.

(defconst ntp-c-style
  '((c-basic-offset  . 8)
    (fill-column     . 72)
    (c-offsets-alist . ((arglist-intro        . +)
                        (case-label           . *)
                        (statement-case-intro . *)
                        (statement-cont       . *)
                        (substatement-open    . 0))))
  "David L. Mills; NTP code indentation style")

(defun ntp-c-mode-common-hook ()
  ;; add ntp c style
  (c-add-style "ntp" ntp-c-style nil))

(add-hook 'c-mode-common-hook 'ntp-c-mode-common-hook)

> What is everyone else's preferred C indent style?

Left to myself, I slightly favor what used to be called Berkeley style
but is now more usually tagged C++ style; 4-space indents with the
opening braces of blocks *not* snugged up against the preceding function
heafer or if/for/while but occupying their own line - so they visually
balance the closing braces.

I dislike the GNU 2-space indent as I find it makes block scopes harder
for me to distinguish, and I dislike 8-space indents like Mills's
because they make me have to wrap code lines too often.  I am
indifferent in the tabs-vs.-spaces controversy because I have Emacs.

I have one personal quirk.  Well before Python was cool I developed
the habit of describing my C functions with a one-line comment
immediately following the function header (like a docstring).  In this
I was influenced by the authors of "The Elements of Programming
Style", who opined that if you can't describe your function in a
one-line comment, it's too large!

However, I am not dogmatic about any of this and generally leave code I
take maintainance of in the style I found it.
-- 
                <a href="http://www.catb.org/~esr/";>Eric S. Raymond</a>
_______________________________________________
devel mailing list
[email protected]
http://lists.ntpsec.org/mailman/listinfo/devel

Reply via email to