2010年3月19日星期五

Eliminate the warning "./common/packet.h warning: deprecated conversion from string constant to ‘char*’"

When compiling NS-2.33, g++ keeps complaining: ./common/packet.h:329: warning: deprecated conversion from string constant to ‘char*’ . There are many places in packet.h cause this warning. The solution to eliminate it is as follows:

packet.h
about line: 401
change the definition of p_info::name_ to static char const** name_;
about line:278
change the allocation of name to const char * *nameNew = new const char*[PT_NTYPE+1];

packet.cc
about line: 44
change the declaration of p_info::name_ to const char** p_info::name_;

ptypes2tcl.cc
line:13
change the declaration of p_info::name_ to const char** p_info::name_;