delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/09/14/22:12:49

Date: Wed, 14 Sep 1994 17:11:51 -0400
From: davis AT amy DOT tch DOT harvard DOT edu ("John E. Davis")
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Silly question

Hi,

   This is a silly question and is not really related to DJGPP.  However, I
think it is somewhat important because it seems to suggest a difference
between DJGPP and BCC.  

For simplicity, assume that DJGPP declares a certain system function as:

   extern int something (const char **);
   
and Borland declares it as:

   extern int something (char *argv[]);
   
The problem is that I have a local variable that is declared as:

   char **argv;
   
I want to call this function but I do not seem to be able to keep both
compilers (gcc and bcc) from complaining.  For example, if I do:

   something (argv);
   
DJGPP gives no warning but BCC complains.  Also, if I do:

   something ((const char **) argv);

DJGPP is silent while BCC complains.  However, if I do:

   something ((char ** const) argv);
   
BCC is happy but now DJGPP is not.   So the question is:

?? How do I make a cast that will stop both compilers from compaining??

Note that to see this effect, you must turn all warnings on.

Thanks,
--John

- Raw text -


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