Problem with "warning: deprecated conversion from string constant to ‘char*’"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I currently write some c++ code using libConfuse
(http://savannah.nongnu.org/projects/confuse/).
During initialisation of the required cfg_opt_t structures I get a
(very) lot of warnings like:
c2.cpp:11: warning: deprecated conversion from string constant to ‘char*'

I attached a small example to demonstrate the problem. It's not
trivial - changing the "name" member
of struct demo being const, free failes (and is invalid, because
there're demo_opt instances with
modifyable names).

Any suggestions welcome.
1) Killing the warning with -Wno-... is not an option
2) Remove the finding using const_cast<char *>() is the same as (1)
3) initializing the struct using strdup is neither reasonable

Jens

PS: Please CC me, I'm not subscribed on the list.

Attachment: const.shar.gz
Description: GNU Zip compressed data


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux