Enjoying Pain… To a Limit
A few days ago I chatted with Evgeny, the Xesam ontology maintainer, on #xesam. As programmers tend to do, we ended up discussing languages…
I’ve been hacking a lot of C/GObject code lately and I am quite enjoying it even though my usual turf has been (the excellent) Python and PyGtk. So why on earth am I enjoying C? It takes 10 times longer to write and debug C code than Python code and on top of that I have to deal with autotools. I guess the reason for my new-found enthusiasm is the same reason that people solve the hardest cross word puzzles they can. The thrill of the challenge.
Anyways. I just used the two of the last four days debugging what seemingly was a nasty refcounting bug, but turned out to be me missing an argument to a varargs function. And then the last two days to debug a particularly nasty race condition in some of my unit testing code for xesam-glib.
Mental note to self, always remember, never forget:
- A GMainLoop does not exit immediately after a g_main_loop_quit()
- g_timeout_add is added in the scope of the default GMainLoopContext not per GMainLoop (as one tend to think of it). If you spawn another GMainLoop later you will revive your timeout handler.
- Always make sure you pass the correct arguments to vararg functions
PS: The second paragraph might give the impression that I like autotools. I don’t.
April 6th, 2008 at 2:50 pm
Autotools is a set of hacks hacked together in a somewhat hackish way, that’s true. But it’s also the best there is. I haven’t seen a good replacement to date; whatever you propose will be missing some of of autotools’ features. In a properly set-up autotools project you can cross-compile, set the prefix, install to anywhere independently of the prefix and supply flags/libraries to individual dependencies when they are not installed where expected; also produce tarballs, recompile only the files which depend on a modified file and other things I didn’t mention, all of this without having to modify any file. Show me how you can do all of this, and as easily, with anything else and I will seriously consider switching.
April 7th, 2008 at 3:29 am
@asdf: I do not have a replacement for Autotools unfortunately. It is somewhere on the bottom of my todo to write one though… This means that I might get to it in 5-10 years
I just get nervous ticks, rashes, and spontaneous outbursts of anger when ever I have to dig into my autotool files.
Anyways, projects like waf and others are making progress and might some day meet the challenge. Although I do not believe that waf is the right approach either, it is still better than autotools imho.