From owner-freebsd-hackers Tue Nov 7 8:32:22 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from topperwein.dyndns.org (acs-24-154-28-99.zoominternet.net [24.154.28.99]) by hub.freebsd.org (Postfix) with ESMTP id 6B0D737B479 for ; Tue, 7 Nov 2000 08:32:19 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by topperwein.dyndns.org (8.11.1/8.11.1) with ESMTP id eA7GWBo07975; Tue, 7 Nov 2000 11:32:11 -0500 (EST) (envelope-from behanna@zbzoom.net) Date: Tue, 7 Nov 2000 11:32:11 -0500 (EST) From: Chris BeHanna Reply-To: behanna@zbzoom.net To: Peter Pentchev Cc: Giorgos Keramidas , hackers@FreeBSD.ORG Subject: Re: umask(2) and -Wconversion In-Reply-To: <20001107121734.D314@ringworld.oblivion.bg> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 7 Nov 2000, Peter Pentchev wrote: > In my experience, the problem is not only with umask(2) - GCC *is* > a bit stubborn about -Wconversion; I wonder if this is really a GCC bug :( > > I'm having the same problems with many other functions when passing > integer constants - even if I explicitly cast them to a long or unsigned > long or plain unsigned int or whatever the particular function needs, > GCC seems to ignore the cast and whines about the conversion nonetheless :( > > Can anybody else confirm this? I can't dig out a code snippet right now, > but ISTR a recurring case of this when compiling with BDECFLAGS a program > which includes ncurses.h, then passes integer constants to init_pair() > or something similar. What happens if you pass an explicit long or unsigned long literal instead of casting an integer literal? Like this: void myfunc( unsigned long); int main( int argc, char* argv[]) { myfunc( 12UL); return 0; } I realize, of course, that going through and changing every array subscript, for example, is a PITA. I'm just curious about whether or not this makes gcc behave nicely. -- Chris BeHanna Software Engineer (at yourfit.com) behanna@zbzoom.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message