P99 is released

P99 – Preprocessor macros and functions for C99

P99 is a toolbox of macro and function definitions that ease the programming in modern C, aka C99. By using new tools from C99 it implements default arguments for functions, scope bound resource management, transparent allocation and initialization, …

The complexity of the tools ranges from very simple (but convenient) macros such as P99_INIT to relatively complex ones such as P99_UNWIND_PROTECT.

P99 is not a library but just a set of include files. You may include the whole by just using “p99.h” or cherry pick individual parts to your needs. You will not have to link against a special library the “only” prerequisite is that your compiler supports modern C, aka C99, to a wide extent.

So far I have tested P99

  • on linux systems
  • with INTEL 32 / 64 bit and ARM processors
  • with four different compilers: gcc, clang, opencc and icc
  • with code from an internal project.

If you are developing for another setting I would be very much curious to hear of your experience with P99.

P99 can be downloaded at p99.gforge.inria.fr. It is licensed under the QPL.

6 thoughts on “P99 is released”

  1. There’s some delightfully hairy code in there! It took me quite some time to make sense of P99_NARG—this after I’d already understood PP_NARG from this comp.lang.c thread. Well done!

    Might I ask why you chose the QPL (GPL-incompatible copyleft) rather than the (L)GPL or the Boost license?

    1. Thanks for the feedback!

      The license is not only my personal choice but a compromise that we cooked up between me and my employer.

      I would have prefered something like the LGPL, I think, but actually it was not so easy to determine what such a thing means for a tool that is source only. There is no linkable library associated, so what would that mean? On the other hand we didn’t wanted to be too restrictive, in particular allow for the distribution of compiled code with that library.

      Because at the moment I am the only author and we possess all the rights, this license could easily change for later versions, if it is a show stopper. For me at first it was important to publish it and to have people try it out.

  2. I have thought about the meaning of LGPL in a source-only context. I suggest that you ask the question at licensing@fsf.org, perhaps they know how LGPL could apply.

    The QPL is also unlear to me in this context. Does it operate as the GPL such that the compiled work must also be available in source form to those who receive the binary, or is it intended to work after the fashion of the LGPL such that those who use P99 must make P99 available to all those who receive a binary?

    To me the QPL clause 6 reads as the GPL in this respect, but because you say that the LGPL was being considered instead of the QPL suggests that you only intend P99 source to be provided.

    Thus currently, the terms under which P99 may be used is unclear.

    1. Sam, thanks for your thoughts. I am not completely the master of this stuff, both in terms of understanding and in terms of having not necessarily the last word.

      The intents of choosing this license was multiple, and it was a compromise between me, the author, and my employer, INRIA. Our idea is

      • Anybody should be able to read the source, use P99 in his own code, distribute binaries of his code that uses P99.
      • For the moment I want to keep my hand on P99, such that any modifications go through me. I had some contributions by other people, but the main work is mine.
      • This also means that if you want to modify the sources to accommodate to another architecture, I want to have my final word, such that the chaos remains limited. This concerns accommodation to compilers (and their bugs) and more recently also to C Libraries.
      • Distribution through suitable channels is fine, as long as it is not “sold” as part of a product. Anybody who has doubts about that should just contact us.
      • What we don’t want to see in particular is compiler or platform providers that use a layer of P99 on top of a non-conforming C99 or C11 implementation just to beautify their hacks. This doesn’t mean that we wouldn’t be willing to work with platform providers, in the contrary, we would be keen to do. But such things go through contracts and institutional projects.

      So if you or anybody else has an other idea what would suit best for these goals, please let me know.

Comments are closed.