g++-4.x gives following warning whenever a string with in double quotes is assigned to a char * :
warning: deprecated conversion from string constant to ‘char*’
Though there is no fix available as far as I know except for following two solutions:
1. convert 'char *' to 'const char*' whenever a string is to be assigned.
2. use a type cast to convert a string to a char*.
For example:
const char *name = "Adam Smith"
char *name = (char*) "Adam Smith"
To get rid of deprecated conversion warning, pass -Wno-write-strings option to g++
Showing posts with label GCC. Show all posts
Showing posts with label GCC. Show all posts
Sunday, August 23, 2009
Subscribe to:
Posts (Atom)