|
-
November 14th, 2010, 09:42 PM
#1
warning: deprecated conversion from string constant to ‘char*’?
I got this warning from the compiler:
warning: deprecated conversion from string constant to ‘char*’
when I tried to pass a string constant to a function that has a char* input argument. Something like
What's the correct way to do this? Thanks!
Last edited by acppdummy; November 14th, 2010 at 09:48 PM.
-
November 14th, 2010, 10:03 PM
#2
Re: warning: deprecated conversion from string constant to ‘char*’?
C89 introduced the const keyword. String literals are now considered const char *s. To preserve backwards compatibility, they allowed implicit conversion between string literals and char *, but it's deprecated. It's safe to say it will not be removed in the next standard though as there are still tons of libraries that do it.
Last edited by ninja9578; November 14th, 2010 at 10:19 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|