add explicit type cast for c++ compile
refactor the c++ keyword "typeid" which was used as a variable