Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964844AbXBLLNA (ORCPT ); Mon, 12 Feb 2007 06:13:00 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S964847AbXBLLNA (ORCPT ); Mon, 12 Feb 2007 06:13:00 -0500 Received: from javad.com ([216.122.176.236]:1423 "EHLO javad.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964844AbXBLLM7 (ORCPT ); Mon, 12 Feb 2007 06:12:59 -0500 From: Sergei Organov To: Linus Torvalds Cc: "J.A. =?utf-8?B?TWFnYWxsw4PDgsKzbg==?=" , Jan Engelhardt , Jeff Garzik , Linux Kernel Mailing List , Andrew Morton Subject: Re: somebody dropped a (warning) bomb References: <45CB3B28.60102@garzik.org> <20070208221317.5beedaeb@werewolf-wl> <87abznsdyo.fsf@javad.com> Date: Mon, 12 Feb 2007 14:12:28 +0300 Message-ID: <874pprr5nn.fsf@javad.com> User-Agent: Gnus/5.110006 (No Gnus v0.6) XEmacs/21.4.19 (linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1630 Lines: 41 Linus Torvalds writes: > On Fri, 9 Feb 2007, Sergei Organov wrote: >> >> As far as I can read the C99 standard, the "char", "signed char", and >> "unsigned char", are all different types: > > Indeed. Search for "pseudo-unsigned", and you'll see more. There are > actually cases where "char" can act differently from _both_ "unsigned > char" and "signed char". > >> If so, then the code above is broken no matter what representation of >> "char" is chosen for given arch, as strcmp() takes "char*" arguments, >> that are not compatible with either "signed char*" or "unsigned char*". > > ..and my argument is that a warning which doesn't allow you to call > "strlen()" on a "unsigned char" array without triggering is a bogus > warning, and must be removed. Why strlen() should be allowed to be called with an incompatible pointer type? My point is that gcc should issue *different warning*, -- the same warning it issues here: $ cat incompat.c void foo(int *p); void boo(long *p) { foo(p); } $ gcc -W -Wall -c incompat.c incompat.c:2: warning: passing argument 1 of 'foo' from incompatible pointer type Calling strlen(char*) with "unsigned char*" argument does pass argument of incompatible pointer type due to the fact that in C "char" and "unsigned char" are two incompatible types, and it has nothing to do with signedness. [...] -- Sergei. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/