Porting to c++