[torquedev] Making code compatible with -Wwrite-strings

Simon Toth simont at mail.muni.cz
Wed Jul 22 05:34:56 MDT 2009


Official DOC:
"When compiling C, give string constants the type const char[length] so
that copying the address of one into a non-const char * pointer will get
a warning. These warnings will help you find at compile time code that
can try to write into a string constant, but only if you have been very
careful about using const in declarations and prototypes. Otherwise, it
will just be a nuisance. This is why we did not make -Wall request these
warnings."

This is a very important warning. The problem is that the current code
is not compatible with this because all string constants are stored in
char*. I would recommend slowly moving towards the compatibility because
writing into string constant is a serious bug

-- 
Mgr. Simon Toth
CESNET z.s.p.o.
Zikova 4
160 00 Praha 6
Czech Republic.


More information about the torquedev mailing list