Andrew Lunn wrote:
Hi Folks
Can anybody figure out what the compiler does not like:
/home/lunn/eCos/anoncvs-clean/packages/language/c/libc/string/current/tests/memchr.c:
In function 'main':
/home/lunn/eCos/anoncvs-clean/packages/language/c/libc/string/current/tests/memchr.c:103:
warning: assignment discards qualifiers from pointer target type
The formal and actual argument differ in constness. What happens if you
replace
(void *)"",
with
(const void *)"",
And what happens if you leave out the cast? String literals are of type
char *, but I seem to remember that they can be used in places where a
const char * is required. (The obviously correct way to handle this
would be to make string literals of type const char *, but it is
reported that that would break existing code.)
Many of the arguments to calls to memchr are adorned with casts. Are
they all really necessary?
Rutger
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss