Freestyling on patterns, idioms and semantics…


vivid hallucinations for bloodthirsty digital vampires

Introducing PFQ…

PFQ is a novel linux kernel module designed for packet capturing on multicore architectures. After 2 months of hard work I’m proud to unveil the first results. Even if the software is still in its infancy the performance is one of its strength.

Read the rest of this entry »

Filed under: linux, networking,

IoC revisited: from callback to closure!

I have been told to consider the IoC pattern for this series and I decided to explore it because I was not really familiar with this pattern.

Wikipedia defines IoC (Inversion of Control) as an abstract principle that describes an aspect of some software architecture design in which the flow control of a system is inverted in comparison to procedural programming. According to Martin Fowler, the term IoC is at least dated 1988, but, it’s still unclear whether it can be considered a pattern or just an architectural principle.

Read the rest of this entry »

Filed under: c++, C++11, programming

Variadic Metafunctions

An interesting use of variadic template arguments [VTA] comes used with metaprogramming: it results in a metafunction that takes a variable number of arguments.

For those who have never heard about metafuncions I would suggest to read a couple of books,  C++ Modern Design Pattern and the more specific C++ Template Metaprogramming. To make the long story short,  a metafunction is a function that runs at compile time. The technique was discovered by Erwin Unruh  years ago when he created a C++ program that, though not compiling, was able to generate the sequence of prime numbers in form of  compiler error messages.

Read the rest of this entry »

Filed under: C++11, programming

The Cool Factor(y)

With the coming of C++0x our previous C++ codes seem to have become too boilerplate. Among the number of important changes and improvements over the core language, the one I like most is the variadic template argument, a new semantic that enables the variable number of template arguments for both template classes and functions.

In turn, the variadic template arguments [VTA], along with the r-value reference that allows the perfect forwarding, enable users to design very compact patterns with a high level of code re-usability, opening the doors to a new way of writing generic code.

Read the rest of this entry »

Filed under: c++, C++11, programming

Singleton: a mirage of perfection

There are a very few lucky girls on earth who have had the pleasure to read the great and yet so chemically romantic book “Modern C++ Design: Generic Programming and Design Pattern Applied“. But if you are not one of them, don’t worry: it really does not matter.

In that book there is an entire chapter devoted to present a whirl of singleton patterns that Andrei Alexandrescu gracefully dissects with his fervid insight of the out most boundaries of the C++ language. Andrei presents a unique, portable, policy-based pattern (also implemented in his Loki library) which aims at covering most features required to build a perfect Singleton.

What? A singleton? Uhmkay, let’s rewind the tape.

Read the rest of this entry »

Filed under: programming, ,

All the things you have always wanted to know about writing a generic perfect forwarder

A generic forwarder is a template function supposed to forward the passed arguments to a target function or a callable object (provided for example as an extra argument).

To be perfect a forwarder must be able to be deployed in different contexts, allowing to pass both lvalue and rvalue parameters, yet having the template parameter types correctly deducted and the target function properly chosen from a possible overloaded set.

The current C++ standard does not allow to implement such a perfect forwarder that instead is enabled by means of C++0x rvalue reference. Nevertheless, a generic non-perfect but correct forwarded is possible with the help of tr1::reference_wrapper.

Read the rest of this entry »

Filed under: c++, C++11, programming, ,

Hello world!

Hello World.

My name is Nicola. I’m a determined hacker, a unix hacker by choice and attitude. I have been an enthusiastic linux programmer since 1995. I have developed opensource applications using i386 AT&T assembler, GNU C and recently C++ languages solely for fun. I believe in the opensource philosophy, I am debian addicted and more importantly I love snowboarding.

Read the rest of this entry »

Filed under: networking, programming

Follow me on twitter…

Error: Twitter did not respond. Please wait a few minutes and refresh this page.