Re: Cast abuse



On 2001.11.19 11:08 Toralf Lund wrote:
...
> Can the str...() declarations be assumed to use "const" properly on 
> all platforms? I seem to remember that _all_ string arguments had 
> type "char *" on some of our systems in a not-to-distant past.
> 
> - Toralf

There does seem to be a problem with iconv:

ICONV(3)            Linux Programmer's Manual            ICONV(3)

NAME
        iconv - perform character set conversion

SYNOPSIS
        #include <iconv.h>

        size_t iconv (iconv_t cd,
                      char* * inbuf, size_t * inbytesleft,
                      char* * outbuf, size_t * outbytesleft);

where inbuf is often passed from a const char * variable.  There are a 
couple of files in libmutt that do this, and gcc gripes each time it 
sees them.  I imagine that's why the casts that Brian complained about 
in the ldap code were there.

I've never seen the code for iconv, so I don't know for sure whether it 
will ever change the contents of inbuf, but the man page indicates that 
it doesn't. What's the appropriate way to code a call to it? Can one 
override the prototype to properly show that inbuf is a const argument?

Peter



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]