FREE Subscription to Dr. Dobb’s Digest: Same Great Content, New Digital Edition
Site Archive (Complete)
C++
Email
Print
Reprint

add to:
Del.icio.us
Digg
Google
Furl
Slashdot
Y! MyWeb
Blink
October 05, 2006
Code Finessing

It's all about quality code

(Page 1 of 5)
Diomidis Spinellis
When it comes down to it, what counts is quality code that is correct, readable, and efficient.
Diomidis is an Associate Professor in the Department of Management Science and Technology of the Athens University of Economics and Business. He is also the author of the "Open Source Perspective" books Code Reading (Software Development Productivity Award, 2004) and Code Quality (Addison-Wesley, 2006). He can be contacted at dds@aueb.gr.


CScout is a refactoring browser for C code that has been in the works for the past five years. When I set out to apply CScout on the Linux kernel source code, I discovered that it failed to correctly expand a couple of C macros, causing the analysis to fail. This prompted me to reimplement CScout's macro expansion using a precise functional specification, then optimize the code's severe degradation in time performance, and finally tidy up the optimized code mess. The work touched on many interesting subjects: correctness, performance, compiler optimizations, and readability. Although the domain I worked on is specialized, the lessons I learned have everyday applicability.

CScout (www.spinellis.gr/cscout) can process workspaces of multiple C projects, mapping the complexity introduced by the C preprocessor back into the original source code files. CScout takes advantage of modern hardware advances (fast processors and large memory capacities) to analyze C source code beyond the level of detail and accuracy provided by current compilers and linkers. For example, CScout lets you rename an arbitrary identifier in your code, and the change correctly propagates to exactly those source code elements (proper C code and macros) that form an equivalent correct code body. To satisfy this tall order, CScout incorporates in its code base a C preprocessor with parts of a compiler and a linker.

1 Code Finessing | 2 The C Preprocessor | 3 Going Functional | 4 Crunch Time | 5 Quality Time Next Page
TOP 5 ARTICLES
No Top Articles.



MICROSITES
FEATURED TOPIC

ADDITIONAL TOPICS

INFO-LINK