delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/07/30/01:52:48

Date: Mon, 30 Jul 2001 08:53:07 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: "Rafal Maj (Raf256)" <raf256 AT go2 DOT pl>
cc: djgpp AT delorie DOT com
Subject: Re: char*[] -> const char** conversion
In-Reply-To: <9k21p0$flc$8@info.cyf-kr.edu.pl>
Message-ID: <Pine.SUN.3.91.1010730085217.11994C-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Mon, 30 Jul 2001, Rafal Maj (Raf256) wrote:

> Why this simple code :
> 
> #include <iostream.h>
> /*const*/ char *napis[] = {"abc","12","xxx"};
> void fun(const char** ptr) { }
> main() {  fun(napis); }
> 
> generates under DJGPP (based on gcc 2.9) error :
> 
>   bug.cc(4) Error: passing `char **' as argument 1 of `fun(const char **)'
>   adds cv-quals without intervening `const'

I think this is a standard issue with C++: const char and char are not 
the same, and you aren't allowed to mix them.  Even C compilers print 
warnings about that nowadays.

- Raw text -


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