This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/23087] Misleading warning, "... differ in signedness"
- From: "schlie at comcast dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Jul 2005 23:58:37 -0000
- Subject: [Bug c/23087] Misleading warning, "... differ in signedness"
- References: <20050726195618.23087.kst@mib.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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