Hi Friends, I'm strongly considering migrating herbstluftwm from C99 to C++11. The reason is, that I felt becoming more and more conservative when mergin patches because I feared that they will let herbstluftwm crash. (An example would be Florian's frame-objects patch). I blame the lack of the following features in C99: - No templates/generics or not much type safety: I have to deal with void* pointers everywhere and have to cast them and hope that it doesn't break. - No real modules: Everything is one huge namespace so the global symbol names get messier and messier. - No implicit freeing of objects. If I have multiple returns within a single function I have to manually free dynamically allocated things at every return. - No anonymous functions or function nesting: If I need a helper function (e.g. to do something with each element of a list), I have to find a new name which is unique within the C-file... By now, I see the following solutions: - Rewrite the whole thing in some nice language which has all this. - Migrate it to a language which is mostly compatible to C99 (e.g. C++11). - Ignore those problems ("The kernel developers don't have these problems although using C99 as well. hlwm is much smaller and we should be able to deal with these things while enjoying the simplicity and speed of C."). Personally, I would choose the compromise of migrating to C++11. I don't like C++ with all it's properties, but it seems to solve the Software-Engineering-Problems of C99. You can find the C++11 version in the "cpp" branch[1]. What do you think? Cheers, Thorsten [1] https://git.cs.fau.de/?p=hlwm;a=shortlog;h=refs/heads/cpp
Attachment:
pgpX9iRVJY3oi.pgp
Description: PGP signature