Add the original code in C++.
Make the original c++ code buildable on Mac OS X.
Add Loukas' comment.