This question is not a duplicate of question:deprecated-conversion-from-string-literal-to-char
But yes I'm trying to get rid of this annoying Clang warning. In that Answer there are the following ways:
- const_cast or (char*)
- foo(char*) -> foo(const char*)
I also found some solution in warning-deprecated-conversion-from-string-constant-to-'char'
- strcpy
- -Wno-write-string
My further question is :
How to set -Wno-write-string in Xcode? Or is there actually such a flag in Clang just as in gcc/g++? I didn't find it in Clang Flag Ref
In my code, I get functions that are defined as foo(char*), they receive string or char* for some time, and receive literal string(e.g. "hello") for other time. For such kind of case, what is the right or proper way to decl/def foo?