[Bug c/23087] Misleading warning, "... differ in signedness"

schlie at comcast dot net gcc-bugzilla@gcc.gnu.org
Tue Jul 26 23:59:00 GMT 2005


------- Additional Comments From schlie at comcast dot net  2005-07-26 23:58 -------
(In reply to comment #2)
> String literals in C are char*, not const char*, though writing to a
> string literal invokes undefined behavior.  But that's not the point.

Actually as string literals are defined as specifying an array of character constants,
a "const char *" type seems most appropriate, which is why a write to a string literal
is undefined.

But agree that GCC should not generate a warning that the types differ in signness
when initializing a signed or unsigned char * with a string literal, as the types are
defined as being compatible; but should generate a warning that a "const char *" is
being assigned to a non-const "char *".


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23087



More information about the Gcc-bugs mailing list