delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/11/30/12:06:33

From: lied AT w-lied DOT ih DOT lucent DOT com (Bob Lied)
Newsgroups: comp.lang.c,comp.os.msdos.djgpp
Subject: Re: what's this mean?
Date: 30 Nov 2000 16:42:27 GMT
Organization: Lucent Technologies, Naperville, Illinois, USA
Lines: 23
Message-ID: <90601j$sdc@ssbunews.ih.lucent.com>
References: <3a267c5f DOT 0 AT news DOT syr DOT edu>
NNTP-Posting-Host: w-lied.ih.lucent.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019