Posted by: rmn on: 31/12/2010
Generic programming is very common and has different names (and features) in various programming languages; C++ provides Turing-Complete Templates, Java offers Generics (along with Ada, Eiffel, C#, and Visual Basic .Net), and Parametric Polymorphism is present in ML, Scala, and Haskell. While I am generally pretty happy with what C++ has to offer, adopting some [...]
Posted by: rmn on: 30/11/2010
Using the initialization list is very much encouraged in C++, and rightfully so - it has many benefits. But what happens if one of your members fails at initialization and actually throws an exception? Even worse: what happens if that member’s constructor throws an exception not in your exception specification list?
Posted by: rmn on: 31/10/2010
Quoting Wikipedia: The word thunk has at least three related meanings in computing science. A “thunk” may be: A piece of code to perform a delayed computation (similar to a closure) A feature of some virtual function table implementations (similar to a wrapper function) A mapping of machine data from one system-specific form to another, [...]
Posted by: rmn on: 30/09/2010
Programming is all about generalizations. We, as programmers, usually do not want to worry about all the small details; We will usually assume that there’s enough physical memory on the machine, we will knowingly use cross-platform libraries to make the operating system we’re running on irrelevant as well, and sometimes we will even resort to [...]
Posted by: rmn on: 31/08/2010
The feature of function overloading can prove to be pretty useful: it allows us to define a few versions of the same function, which differ in argument types, or even in Arity (ignoring variadic functions for the moment). Unfortunately, the C\C++ pre-processor does not allow overloading macros in the same way; It treats such attempts [...]
Posted by: rmn on: 17/07/2010
The C-Preprocessor is a very powerful mechanism, which offers many different features. One of these features is called Variadic macros: macros that accept a varying number of arguments. It is interesting to note at this point, that such Variadic macros, despite being part of the C99 Standard, are not part of the C++ Standard at [...]
Posted by: rmn on: 31/05/2010
In the concurrent world, a Future object refers to an object whose actual value is to be computed in the future. You can think of it as a handle to an asynchronous invocation of a computation that yields a value. Many so called concurrent programming languages support this idea as a native construct offered by [...]
Recent comments