Two things have been annoying me this week. One is lua, or more precisely its garbage collection method, or more precisely the way it garbage collects file handles. Conceptually when a file handle is opened by lua it is associated with a closure that will take care of closing it afterwards. All very fine and dandy from a GC PoV but it is annoying if you want to pass it a file handle via the C API that you want to take care of yourself Thank-You-Very-Much-Mr-Lua. In theory I just need to find out how to associate it with a closure that does what I want (in this case nothing) but buggered if I can find out how. The source to lua is somewhat entropy-rich :). For the moment I’ve hacked in a test to see if there is a closure before calling it which at least silently swallows the null pointer dereference but it feels dirty.
The second annoying thing is that Visual C++ 2005 doesn’t seem to be able to handle variables of type __m128 in templates. Or in fact in pretty much anything ‘clever’ (e.g. unions[1]). Another reason to be wary of templates methinks.
[1] The writing of a cross-platform native CPU vector-type handling library is mercifully not my problem but the guy whose problem it is (who wrote a couple for some games studios) delights in telling me how crap the compiler support is :).