This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: cpplib: more type correctness


On Thu, Mar 09, 2000 at 08:47:19PM +0900, Neil Booth wrote:
> This patch:
> 
> o Replaces all remaining b- and (r)index function calls
> o Adds casts to the return value of all memory allocations
> o Makes some char pointers "pointers to const" which previously were
> not

The principle is good, but I'm going to be picky again.  There are a
few issues with this.  The most important one is:

 - Why have you changed a number of interfaces to take const char *
   instead of const unsigned char * ?

I don't like any patch that increases the amount of plain chars
floating around. If you can demonstrate that this decreases the number
of casts _and_ the plain chars can't possibly be interpreted
differently depending on whether plain char is signed, then it's ok;
otherwise not.

Then we have some lesser problems:

 - Don't cast between U_CHAR * and char * except when passing U_CHAR *
   to or from a C library function that takes plain char *, or when
   assigning a string constant to a U_CHAR * variable.  Fix the types
   instead.

 - If you're going to cast the argument of free, cast it to (PTR).
 - It's not necessary to cast the return value of malloc to char * or
   const char *.  It is necessary to cast it to U_CHAR *.
 - I see a number of places where you set ihash->control_macro to
   (U_CHAR *) "".  Instead, you should make ihash->control_macro be
   const.

> OK to commit?

Do you have write privileges yet?  I haven't seen MAINTAINERS be
updated.

zw

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]