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
andicc
- 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.
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?
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.
Your link to the QPL license is broken.
Sam, thanks for the notice.
I updated the link to point on the wikipedia page, hopefully this will last a bit longer.
Jens
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.
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
So if you or anybody else has an other idea what would suit best for these goals, please let me know.