About

Hello and welcome to this site where I, Jonas Skeppstedt, will make posts about C programming and on optimizing compilers (with focus on what they can and cannot do for you but not their internals for which there will be another site).

About myself: I wrote my first C compiler as a MSc thesis at Lund University in Sweden for the SPARC architecture in 1990. The optimization modules were based the Dragon book. This compiler was then used for my PhD work in Lund, University of Southern California (with Professor Michel Dubois) and at Chalmers University of Technology under supervision of Professor Per Stenström. The thesis was about exposing the cache coherence protocol to the compiler in order to let it control some of the protocol actions,  such as requesting memory block ownership in a load instruction instead of first loading and then requesting ownership at a subsequent store instruction.

I work at Lund University and teach courses on C programming, optimizing compilers and operating systems. Starting in 1997 I rewrote my compiler to base the optimizations on SSA form and switching from SPARC to Power. This compiler,  lmpcc, was validated to conform to the ISO C99 standard in 2003.

I have written two books, one on C with Christian Söderberg and one on the theory of optimizing compilers. The C book is available at Amazon and Swedish online book stores.

3 thoughts on “About

  1. Hello there!
    I can’t find anything on function pointers in the book. Have I missed it or is it not covered by the book? Except that I enjoy the book quite much and am looking forward to your book on Scala.
    Best regards.

    1. Hello Mattias!

      Function pointers are mentioned in Section 13.19.1 on page 522 about integer types that can hold pointers to objects (i.e. not pointers to incomplete or or to function types), and in Section 13.21.5.2 on page 558 about qsort and in Example 13.21.7 on the following page. There is it is shown how a function pointer can be passed as a parameter. In Section 16.2.1 on page 682 about compilers doing register allocation of global variables — and that calls through function pointers introduce extra overhead due to the uncertainty of which function was called (and hence how the register-allocated global variable can be accessed).

      But you are correct, there is no specific example showing how a call through a function pointer can be done. Basically, if we have a function pointer void (*fp)(int) then a call through it can be done as (*fp)(42).

      I will add a more elaborate example here shortly.

      Thank you for your comment!

      Best regards,
      Jonas

  2. About the Scala book, it will for beginning programmers. More specifically, about beginning programmers at the Viking age who visit relatives in Germany and need to find a fast TSP route through the villages and towns in Saxony to warn them before King Karl of Aachen kills them… It will be exactly 100 pages.

    Jonas

Leave a Reply

Your email address will not be published. Required fields are marked *