[quake3-bugzilla] [Bug 4598] New: const pointers in strtod/strtol

bugzilla-daemon at icculus.org bugzilla-daemon at icculus.org
Sun Apr 18 08:36:39 EDT 2010


http://bugzilla.icculus.org/show_bug.cgi?id=4598

           Summary: const pointers in strtod/strtol
           Product: ioquake3
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: minor
          Priority: P3
         Component: Misc
        AssignedTo: zakk at icculus.org
        ReportedBy: bugzilla at benmachine.co.uk
         QAContact: quake3-bugzilla at icculus.org


Created an attachment (id=2335)
 --> (http://bugzilla.icculus.org/attachment.cgi?id=2335)
const-compatibility with libc

This is pretty annoying and stupid. Any code that uses my strtol/strtod
implementations will find that if they use a char ** for the second parameter
then q3lcc will be upset because it wants a const char **. But then if they use
a const char ** then gcc will complain while compiling the shared libraries
because it wants a char **. The trouble is that the signatures given in
bg_lib.h and in libc's stdlib.h differ in incompatible ways.
Turns out that the problem is you can't safely assign char ** to const char **:
http://c-faq.com/ansi/constmismatch.html
so a function accepting const char ** is inconvenient to use.
The only recourse is to cover the implementations in const-discarding casts
which is unpleasant but seemingly necessary.

-- 
Configure bugmail: http://bugzilla.icculus.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the quake3-bugzilla mailing list