Catalina: Now you can have your Cake and eat it too! - C89, C99, C11 or C23!
This is exciting! As well as C89, Catalina can now compile C99, C11 & C23 programs! And I didn't need to do a thing! How is that possible?
Well, the answer is that I just found out about cake - a transpiler for converting C23, C11 or C99 programs to pure C89. So now all these C variants can be compiled by Catalina^^. I had been working on my own utility to just add a few of the more useful C99 features (such as the ability to declare variables anywhere in the program, rather than just at the start of each block), but cake is already much more advanced and comprehensive, so I am going to adopt it instead.
While cake it is still experimental, everything I have tried so far seems to work. And its level of support for C99 (in particular) is far more complete than anything I would have attempted. For a summary, see here.
The main things currently missing from C99 support are things that I would have recommended avoiding in any case (e.g. Variable Length Arrays, which were eventually seen as a misfeature and made optional in C11) or things I would never use and would probably also not have bothered implementing (like complex numbers).
And the best thing is that on Linux, you can try it out right now! Just download cake, compile it and use it like a preprocessor - i.e. transpile your C99 program to C89 with cake, and then compile the C89 output with Catalina. For example, after setting it up, you might use commands like:
cake program.c -o cake.c catalina -p2 -lc cake.c -o program
Currently, this is easy on Linux because cake also uses gcc on that platform, but on Windows it does not. I intend fixing that in a version for Catalina. Also, while cake generates relatively pure C89, it assumes the results will be compiled with gcc, which has a different set of header files than Catalina does. This means that while many things will work "out of the box", some things that needs specific header files to be included may not. So I will be adding a cake back-end targeted specifically at Catalina, so that eventually everything will just work.
I wanted to start a new thread for this because I am interested in feedback while I work on it - in particular any C99 features that do not work, or which are not implemented but someone thinks would be essential. I hope to get involved in the cake project myself, once I am more familiar with it, because I think this idea has legs!
However, it is not something that I need to do all by myself. This project could be undertaken by anyone with a reasonable C knowledge, and I would be happy to take a back seat and let someone else take the lead. Anyone who may be interested, please let me know.
Ross.
^^ which also shows that these later variants of C are really just show ponies! The only truly truly necessary C is ANSI C!
Comments
That is great news.