I googled and it's present in GCC 4.2.3+ and can be disabled by one of these:
-Wno-deprecated
-Wno-write-string
The thing is, I can't find any such setting in Code::Block's IDE
Edited by Acharis, 25 November 2012 - 06:22 PM.
Posted 25 November 2012 - 06:00 PM
Edited by Acharis, 25 November 2012 - 06:22 PM.
Posted 25 November 2012 - 06:21 PM
Please, no religionThat's not one of the warning's I'd consider useless. Pointing a non-const pointer at const memory is bad juju. Why not just use a const char * instead?
Posted 25 November 2012 - 06:32 PM
const exists for a reason, if you end up in a situation where your const char* (which points to a string constant) has to be modified, your design has failed and const helps you catch that with -fpermissive. You are just asking for trouble here.Please, no religion
That's not one of the warning's I'd consider useless. Pointing a non-const pointer at const memory is bad juju. Why not just use a const char * instead?Half of the people will say one should rewrite everything to const char * the other half will say it's an insane idea and this topic will turn into a discussion about good coding practices.
I just want to know how to disable it
Posted 25 November 2012 - 06:36 PM
Please, no religion
That's not one of the warning's I'd consider useless. Pointing a non-const pointer at const memory is bad juju. Why not just use a const char * instead?Half of the people will say one should rewrite everything to const char * the other half will say it's an insane idea and this topic will turn into a discussion about good coding practices.
I just want to know how to disable it
Posted 25 November 2012 - 06:52 PM
void message(char * s) {}
message("hello world");
would give a warning. It was never like that in the past, over the decades. Making this "Obsolete" after, well, so many generation when it was all right just make no sense
Posted 25 November 2012 - 07:00 PM
I don't understand what is wrong with adding const to the function signature?! Clearly the string must be read-only since you're passing a literal, so marking it with const is the right thing to do to ensure it can never be modified. Don't throw C++ type safety away just because you don't like reading warnings, you'll be glad to have that warning when your code explodes in your face.Sigh... OK, the thing is that all functions like this:
void message(char * s) {} message("hello world");would give a warning. It was never like that in the past, over the decades. Making this "Obsolete" after, well, so many generation when it was all right just make no senseAs far as I know only newest GCC compiler has this flaw, no other compiler have it set that strict. It basicly makes above 99% of examples/code that was written in the past causing that kind of warning.
Posted 25 November 2012 - 07:11 PM
Posted 25 November 2012 - 08:09 PM
Thanks, that solved it.You can do it per-project as Bacterius suggested, or you can do it globally. Go to Settings->Global Compiler Settings->Other options and add the -Wno-write-strings there. I actually don't recommend you do it globally, though, since you shouldn't get in the habit of ignoring warnings.
Posted 25 November 2012 - 11:24 PM
I use tolua++ to generate Lua bindings and unfortunately, as it currently stands, the generated binding code is filled to the brim with these warnings.