From owner-freebsd-questions@FreeBSD.ORG Tue Jun 10 02:21:31 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1FCC437B401 for ; Tue, 10 Jun 2003 02:21:31 -0700 (PDT) Received: from perrin.int.nxad.com (internal.ext.nxad.com [69.1.70.251]) by mx1.FreeBSD.org (Postfix) with ESMTP id AA56D43FA3 for ; Tue, 10 Jun 2003 02:21:30 -0700 (PDT) (envelope-from sean@nxad.com) Received: by perrin.int.nxad.com (Postfix, from userid 1001) id D181321058; Tue, 10 Jun 2003 02:21:29 -0700 (PDT) Date: Tue, 10 Jun 2003 02:21:29 -0700 From: Sean Chittenden To: Malcolm Kay Message-ID: <20030610092129.GP65470@perrin.int.nxad.com> References: <20030609230324.GL65470@perrin.int.nxad.com> <200306101825.33674.malcolm.kay@internode.on.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200306101825.33674.malcolm.kay@internode.on.net> X-PGP-Key: finger seanc@FreeBSD.org X-PGP-Fingerprint: 3849 3760 1AFE 7B17 11A0 83A6 DD99 E31F BC84 B341 X-Web-Homepage: http://sean.chittenden.org/ User-Agent: Mutt/1.5.4i cc: questions@freebsd.org Subject: Re: gcc me harder: -Wconversion bug? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Jun 2003 09:21:31 -0000 > It seems to me that this is doing exactly what is claimed for -Wconversion. > To quote from the gcc man page: > -Wconversion > Warn if a prototype causes a type conversion that > is different from what would happen to the same ar- > gument in the absence of a prototype. ... > > Now in the absence of a prototype for f() the argument true would be > promoted from char/bool to int before being passed to the > function. With the prototype in scope it is not promoted. Different > argument widths so warning delivered. % cpp test.c # 1 "test7.c" # 1 "" # 1 "" # 1 "test7.c" # 1 "test7.h" 1 # 13 "test7.h" void f(char b); # 2 "test7.c" 2 int main(int argc, char *argv[]) { f((((char)1))); return(0); } void f(char b) { } Am I missing something that says that there isn't the prototype of the same width? Last time I checked my vision, f(char b) was the same as f(char b)... :-/ or am I missing something? I believe that gcc's promoting the char to an int or to some other non-1 byte width data type... but I'm not seeing how, where, or why. -sc -- Sean Chittenden