Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Nov 2000 11:32:11 -0500 (EST)
From:      Chris BeHanna <behanna@zbzoom.net>
To:        Peter Pentchev <roam@orbitel.bg>
Cc:        Giorgos Keramidas <keramida@ceid.upatras.gr>, hackers@FreeBSD.ORG
Subject:   Re: umask(2) and -Wconversion
Message-ID:  <Pine.BSF.4.21.0011071129430.7959-100000@topperwein.dyndns.org>
In-Reply-To: <20001107121734.D314@ringworld.oblivion.bg>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0011071129430.7959-100000>