This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: cpplib: more type correctness
- To: Neil Booth <NeilB at earthling dot net>
- Subject: Re: cpplib: more type correctness
- From: Zack Weinberg <zack at wolery dot cumb dot org>
- Date: Thu, 9 Mar 2000 10:09:04 -0800
- Cc: gcc-patches at gcc dot gnu dot org
- References: <E12T1PT-0000x2-00@monkey.rosenet.ne.jp>
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