Writing Efficient C Code: A Thorough Introduction for Java Programmers was written for two groups of readers:
- Java programmers who want to learn C from the beginning, and
- practicing C programmers who want to sharpen their skills.
Our goal with the book is to give the reader a deep understanding of both the ISO C programming language and a method based on performance measurements to write efficient C code.
We present essentially all of C99 and the new revision of the C standard, called C11. In addition to C, we introduce elementary computer architecture and essential C development tools including the
gcc
compiler, the
gdb
debugger, profilers, and the Valgrind suite of tools for performance analysis and automatic detection of software defects. Using performance measurements and a deep knowledge about which code transformations optimizing compilers can perform automatically, as well as their limitations, as the basis for the method for writing efficient C code, the readers of this book will hopefully become more productive and more competent in writing correct, maintainable and fast C code.
In order to achieve this goal, and to help C programmers visualize the machine code and the clock cycle counts of their code, the book contains one chapter on the internals of modern optimizing compilers, and the necessary background on how C is translated to machine code for a RISC processor.
Additional information about the book can be found at
http://writing-efficient-c-code.com
.
PrerequisitesThe reader is assumed to have studied computer programming e.g. with Java, which is used in the first chapter for explaining the key concepts of C.
About the authorsDr. Jonas Skeppstedt has done research on optimizing compilers and multicore computer architecture in Lund, Chalmers, and USC in Los Angeles; his
lmpcc
compiler was rewarded ISO C certification in 2003 for C99; has taught C programming at Lund University for many years and has developed safety-critical C code for the new European Rail Traffic Management System (ERTMS), and helped German lawyers as expert witness on the C programming language.
Christian Söderberg has been teaching programming at Lund University for 20 years.