Den 2009-11-30 16:47 skrev Bob Friesenhahn:
On Mon, 30 Nov 2009, Ralf Wildenhues wrote:

Well, the cast only looks random as long as we don't know a good
rationale for it, I guess.

I should mention that there is a very good reason why strrchr() should return 'const char *'. The reason is that the input string is 'const char *' and since the returned string points into the input string, it would be wrong for it to not also be 'const char *'

Right, this is perhaps a better fix?

2009-11-30  Peter Rosin  <p...@lysator.liu.se>

        Please C++ compilers when calling strrchr.

        * libltdl/ltdl.c (has_library_ext): Match the return type of
        strrchr with the first argument to please C++ compilers.
        Report by Peter O'Gorman.

Cheers,
Peter

--
They are in the crowd with the answer before the question.
> Why do you dislike Jeopardy?
diff --git a/libltdl/ltdl.c b/libltdl/ltdl.c
index 24ee13f..e2accff 100644
--- a/libltdl/ltdl.c
+++ b/libltdl/ltdl.c
@@ -1507,7 +1507,7 @@ file_not_found (void)
 static int
 has_library_ext (const char *filename)
 {
-  char *       ext     = 0;
+  const char * ext     = 0;
 
   assert (filename);
 

Reply via email to