compile with c++11 and use a few simple c++11 idioms
NULL -> nullptr