On Mon, Nov 26, 2012 at 8:10 PM, Tito Mari Francis Escaño
<titomarifran...@gmail.com> wrote:
> I'm trying to re-learn ANSI C as part of the effort to write a book for
> beginners or intermediate level. I'm thinking of including the use of ANSI
> C code compliance checker, similar to PHP CodeSniffer, that detects whether
> a given C program file complies with a coding standard. Can you please give
> me pointers what tools OpenBSD developers use for this purpose? I
> understand that indent is used to format a given program file, but how
> about detecting whether a given file is coding standard compliant?

The only tool *this* OpenBSD developer uses for checking *coding
standard* compliance is his brain.  For KNF stuff (c.f. style(9)) you
just read enough of it and the stuff that's wrong starts to stick out.
 But really, that's just the bottom level: syntax is important only
because it can obscure the semantics.  It's like when reading a book:
the font it was printed in doesn't matter unless it distracts you from
the *words*.

What's important in coding style are things like clarity, portability,
and efficiency.  While a few aspects of portability can be checked
mechanically, those mostly have to be checked *and balanced* by a
brain.


I recommend the book "The Practice of Programming", by Brian W.
Kernighan and Rob Pike, for those interested in these sorts of
considerations.


Philip Guenther

Reply via email to