All~ On 11/6/05, Joshua Juran <[EMAIL PROTECTED]> wrote: > On Nov 5, 2005, at 4:27 PM, Joshua Hoblitt via RT wrote: > > >> [EMAIL PROTECTED] - Tue Nov 01 04:52:22 2005]: > >> > >> This patch fixes two classes of issue. > >> > >> * Don't assign -1 to an unsigned variable; use ~0U instead as it > >> makes it clear that the value is intended to be out-of-band (g++ > >> warned about this, and C compilers will increasingly) > >> > >> * Change a K&R prototype in a config test > >> > >> Regards, > >> > >> Nick > > > > I've applied the bit of the patch that removed the K&Rism in > > config/auto/alignptrs/test_c.in as r9803. I don't think that anybody, > > myself included, like the idea of using ~0U as a magic value. Can I > > consider this bug 'resolved'? > > > > Cheers, > > > > -J > > If -1 causes warnings, I'd think it should be replaced. I agree that > ~0U isn't readable. How about defining a named constant? That solves > both problems, and has the additional benefit of making the client code > self-documenting.
Another option is to explicitly cast it as follows: uint foo = (uint)(-1); The last set of parens is unecessary, but I like them. This also makes it fairly clear that you are doing something odd. Matt -- "Computer Science is merely the post-Turing Decline of Formal Systems Theory." -Stan Kelly-Bootle, The Devil's DP Dictionary