delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/03/10/15:21:01

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Date: Wed, 10 Mar 2004 14:22:54 -0500
From: David Witbrodt <dawitbro AT alpha DOT delta DOT edu>
Subject: Is this a bug?
To: DJGPP mailing list <djgpp AT delorie DOT com>
Message-id: <404F6B0E.74DA774A@alpha.delta.edu>
Organization: Delta College
MIME-version: 1.0
X-Mailer: Mozilla 4.79 [en] (Win98; U)
X-Accept-Language: en
Reply-To: djgpp AT delorie DOT com

Hi,

  Is this yet another detail I do not understand, or is it some sort
of compiler bug?  Consider the following short program:

  // conv.cpp
  void  parsecomline  (int, const char**);

  int  main  (int argc, char **argv)
  {   parsecomline (argc, argv);
      return 0;
  }


This fails to compile with the following message:

  conv.cpp: In function `int main(int, char**)':
  conv.cpp:8: error: invalid conversion from `char**' to `const
char**'


This is the sort of conversion that I expect to work automatically. 
For example, the following program compiles just fine:

  //conv2.cpp
  void  f  (const char*);

  int  main  (void)
  {   char c, *cp = &c;
      f (cp);
      return 0;
  }


Dave W.

- Raw text -


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