Message-Id: <199809071523.RAA36830@ieva06.lanet.lv> From: "Andris Pavenis" To: djgpp-workers AT delorie DOT com Date: Mon, 7 Sep 1998 17:27:53 +0300 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Problem with DJLSR202 and EGCS-1.1 Precedence: bulk Hi! There is one problem building DJLSR202 with egcs-1.1 (I think there is the same problem also with 2.01): If the compiler option -Wcast-qual is specified egcs-1.1 issues warning when casting some pointer types (previous versions failed to do this, as I think warning is correct). I'm giving and example that ilustrates this problem: #include void foo ( const char * const * ); int main (int argc, char ** argv) { const char * t1 = *argv; char * const * t2= (char * const *) & t1; // Construction used in djlsr. Gives warning: // cast discards `const' from pointer target type const char * const * t3 = argv; // Gives error: // initialization from incompatible pointer type foo (argv); // Gives error: // passing arg 1 of `foo' from incompatible pointer type return 0; } The first fix I tried was to replacing 'char * const *' by 'const char * const *' but it cannot be solution of problem as all gcc versions I tested refuses cast from 'char **' to 'const char * const *' in procedure parameters unless I'm specifying it explicitly. Therefore we should not use 'const char * const *' in include files as such type requires explicit cast from 'char **' So looks that only one solution remains: converting the type using unions that already were used in djlsr. (Of course if we don't want to remove options -Wcast-qual and(or) -Werror). And let's hope that future versions of gcc will not catch such attempts to fool gcc using unions. Andris