On 2017/4/5 21:51, Mateusz Mikuła wrote:
> Conversion from const pointer to normal pointer is definitely unsafe but
> that's probably what GCC just did.
> I'm unsure what you mean by "union-cast" but you can commit your fix.
Take a look at the prototype of the `strchr` function in the C standard
library. Its first parameter is of type `const char *`, but its return
value is of type `char *`.
Only by having such a declaration can the following two function calls
compile, since C does not allow overloading:
char s1[] = "hello world!";
const char *s2 = s2;
char * p1 = strchr(s1, '!'); // [1]
const char *p2 = strchr(s2, '!'); // [2]
--
Best regards,
LH_Mouse
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public