Re: Cast abuse
- From: Brian Stafford <brian stafford uklinux net>
- To: Pawel Salek <pawsa theochem kth se>
- Cc: balsa-list gnome org
- Subject: Re: Cast abuse
- Date: Tue, 20 Nov 2001 11:09:11 +0000
On Tue, 20 November 10:38 Pawel Salek wrote:
>
> On 2001.11.20 11:17 Brian Stafford wrote:
>>> 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 just checked glibc 2's iconv.h and the one distributed with GNU
>> libiconv. Both declare inbuf to be const. SUSv2 declares it const too.
>> So I'd say the linux man page is incorrect.
>
> glibc-devel-2.2.4-19:/usr/include/iconv.h contains:
>
> extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
> size_t *__restrict __inbytesleft,
> char **__restrict __outbuf,
> size_t *__restrict __outbytesleft);
>
> I do not know what '__restrict' means (anybody knows?) but it does not
> appear to be equivalent to 'const'.
Hmmm... something of a moving target it seems. AFAIK, GNU libc is like
libiconv (same code actually), LIBICONV_CONST is substituted with const or is
empty according to what configure detects. The distributed file is iconv.h.in
and declares
extern size_t iconv (iconv_t cd, @LIBICONV_CONST@ char* * inbuf,
size_t *inbytesleft, char* * outbuf, size_t
*outbytesleft);
From SUSv2's description of iconv()
...
SYNOPSIS
#include <iconv.h>
size_t iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft);
...
Brian
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]