[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnu-arch-users] hackerlab, tla, and `char' signedness
From: |
Ludovic Courtès |
Subject: |
Re: [Gnu-arch-users] hackerlab, tla, and `char' signedness |
Date: |
Fri, 13 Jan 2006 10:25:42 +0100 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux) |
Hi,
Andy Tai <address@hidden> writes:
> I have reservations about this... while these warnings (also seen on x86)
> from gcc 4 are indications of possible problems, I am not sure in eacn case
> the intention of people when using char mean they are unsigned.
> This may have other unseen consequences. Maybe it is better to go to the code
> and fix the warnings.
To summarize:
1. `unsigned char', `signed char', and `char' are all different, even
though `char' ``usually'' (meaning that this is
implementation-dependent, unspecified behavior) behaves as one of the
two others;
2. the type of literal strings is `char *'.
Therefore, suppose you have:
extern int str_casecmp (const t_uchar * a, const t_uchar * b);
Passing a literal string to `str_casecmp ()' will raise a warning.
Fixing it in the code would require casting each and every literal
string to `t_uchar *', which is not reasonable. I'm sure you'll agree.
;-)
I don't think passing `-funsigned-char' is likely to have undesired
consequences since currently `char' is (wrongfully) assumed to be
`unsigned'.
Thanks,
Ludovic.