I am using the pcre2 library, and it has a special 'string-type' defined as PCRE2_SPTR8
.
If I try and initialize a string with something like:
PCRE2_SPTR8 s = "my string";
I'll get a warning such as:
warning: initializing 'PCRE2_SPTR8' (aka 'const unsigned char *') with an expression of type 'char [27]' converts between pointers to integer types with different sign [-Wpointer-sign]
What would be the suggested way to initialize this type of string? Doing something like:
PCRE2_SPTR8 s = (PCRE2_SPTR8) "my string";
Additionally, out of curiosity why is a normal "string" usually defined as char* string = "something";
instead of unsigned char* string = "something";
. Is there any advantage/disadvantage of defining a string with a signed vs. unsigned char?
没有评论:
发表评论