Posted in August 24, 2010 ¬ 20:26h.Ronald Landheer-Cieslak
One of the most-occurring subpatterns I keep running into lately is an event-handling subpattern. I say subpattern because it is not a pattern in and of itself: it can be part of an observer pattern, a state machine, or of any other pattern in which objects that have neither an “is-a” nor an explicit “has-a” [...]
Read the rest of this entry »
Posted in June 4, 2010 ¬ 18:54h.Ronald Landheer-Cieslak
While going through some old code, for another article I’m writing that will come up on the blog, I came across an implementation of binary search in C. While the implementation itself was certainly OK, it wasn’t exactly a general-purpose implementation, so I thought I’d write one and put it on the C++ for the [...]
Read the rest of this entry »
Posted in June 1, 2010 ¬ 19:26h.Ronald Landheer-Cieslak
The following is the complete code of a lock-poor stack in C/C++: it’s mostly C but it uses Relacy for testing, so the atomics are implemented in C++. With a little work, you can turn this into a complete C implementation without depending on relacy. I wrote in while writing an article that will soon [...]
Read the rest of this entry »
Posted in February 4, 2010 ¬ 23:02h.Ronald Landheer-Cieslak
I know you must have been aching for the response to the quiz from three weeks ago. If you haven’t thought of your own answer yet, go back to the code and have another look. Try running it through a compiler with all the warnings turned on – it might tell you what the bug [...]
Read the rest of this entry »
Posted in January 16, 2010 ¬ 00:42h.Ronald Landheer-Cieslak
One of the things I do as a analyst-programmer is write software – that would be the “programmer” part. I usually do that in C++ but, sometimes, when the facilities of C++ aren’t available (e.g. no exception handling and no RTTI) C becomes a more obvious choice. When that happens, RTTI is not the thing [...]
Read the rest of this entry »
Posted in October 26, 2009 ¬ 11:22h.Ronald Landheer-Cieslak
There is probably nothing worse than badly defined semantics: functions that might (or might not) take ownership of the object you pass to them can be a serious maintenance headache.
Read the rest of this entry »
Posted in September 18, 2009 ¬ 21:18h.Ronald Landheer-Cieslak
Any problem is an invitation to find a solution. Any solution – at least in my line of work – is an amalgam of concrete implementations of abstract concepts. Each of those implementations may or may not meet the requirements just like any of those concepts may or may not be the right one for [...]
Read the rest of this entry »
Posted in August 31, 2009 ¬ 23:26h.Ronald Landheer-Cieslak
When writing library code, one of the snares to watch out for is binary compatibility. I have already talked about the dangers of breaking binary – and API – compatibility but I had neither defined what binary compatibility is, now how to prevent breaking it. In this post, I will do both – and I [...]
Read the rest of this entry »
Posted in August 24, 2009 ¬ 15:39h.Ronald Landheer-Cieslak
Xerces-C is without a doubt one of the most popular DOM implementations in C++ (and its Java sibling undoubtedly the most popular implementation for Java). As with any project that lives under the banner of the Apache Foundation the project is managed using a meritocracy-style project management scheme and has been, quite successfully, for the [...]
Read the rest of this entry »
Posted in August 18, 2009 ¬ 16:33h.Ronald Landheer-Cieslak
In C++, any name that starts with and underscore followed by an uppercase letter and any name that contains two consecutive underscores is reserved for any use [lib.global.names] and any name that begins with an underscore is reserved in the global namespace. The intent for this, as explained by several people on comp.std.c++ is to [...]
Read the rest of this entry »