Re: somebody dropped a (warning) bomb

J.A. Magallón
2007-02-08T21:13:42Z

On Thu, 8 Feb 2007 11:53:38 -0800 (PST), Linus Torvalds <torvalds@linux-foundation.org> wrote:

>
>
> On Thu, 8 Feb 2007, Jan Engelhardt wrote:
> >
> > I generally have to agree with you about the unsigned char* vs char*. It
> > is a problem of the C language that char can be signed and unsigned, and
> > that people, as a result, have used it for storing
> > "shorter_than_short_t"s.
> >
> > What C needs is a distinction between char and int8_t, rendering "char"
> > an unsigned at all times basically and making "unsigned char" and
> > "signed char" illegal types in turn.
>
> No, it's really more fundamental than that.
>
> Exactly because "char *" doesn't have a defined sign, only a TOTALLY
> INCOMPETENT compiler will warn about its signedness.
>

Perhaps the problem is that gcc warns you something like 'if you care
anything about the sign behaviour of what you send to strlen() you're doomed'.
Ie, you declared the var unsigned, so you care about it. But I can do
anything without any regard to the sign.

--
J.A. Magallon <jamagallon()ono!com> \ Software is like sex:
\ It's better when it's free
Mandriva Linux release 2007.1 (Cooker) for i586
Linux 2.6.19-jam06 (gcc 4.1.2 20070115 (prerelease) (4.1.2-0.20070115.1mdv2007.1)) #1 SMP PREEMPT