Mail Archives: djgpp/2000/11/30/12:06:33
In article <3a267c5f DOT 0 AT news DOT syr DOT edu>, Andrew Clark <anclark AT syr DOT edu> wrote:
>bige.c:15: warning: passing arg 2 of 'mem_err' dicards qualifiers from
>pointer target type
>
>line 15:
>
>mem_err("could not create %s\n", names_east[i]);
>
>where mem_err is a function taking 2 char *'s and returning void.
>names_east is a static const char *[].
>
>what does this warning mean?
Qualifiers are "const" and "volatile". You're passing a const
variable to a function that accepts a non-const argument,
therefore losing the const-ness within the the function.
It's possible that mem_err() could munge names_east[i], even
though you thought it was constant. If you're sure it's
safe, you can get rid of the warning with a const_cast:
mem_err("yada yada", const_cast<char *>names_east[i]);
--
Bob Lied SU BSEE'81
- Raw text -