bug-gnulib
[Top][All Lists]
Advanced

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

Re: [Bug-gnulib] readtokens bug


From: Bruno Haible
Subject: Re: [Bug-gnulib] readtokens bug
Date: Tue, 14 Jan 2003 14:58:35 +0100 (CET)

Jim Meyering writes:
> How about removing the cast altogether and making it be of type
> `unsigned char const *' instead?

This path leads to a dead end. Ulrich Drepper and I tried this on
gettext's libintl and clisp, independently, and we both came to the
conclusion that it leads to madness. More precisely, the 'unsigned
char *' types spread across function prototypes, variables, etc., and
at the end you get a warning for things like

      const unsigned char *string = "literal";

The right way to do this, that generates no compiler warnings and also
works in C++, is to convert from 'char' to 'unsigned char' immediately
after accessing a byte in a string.

> That doesn't evoke a warning with -Wall and a recent snapshot of
> gcc.

There are also C++ compilers. They still give errors for 'char *' /
'unsigned char *' mismatch.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]