gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gnugo-devel] I stepped on a bug


From: Arend Bayer
Subject: Re: [gnugo-devel] I stepped on a bug
Date: Fri, 7 Oct 2005 23:34:52 +0200 (CEST)




Gunnar wrote:

> > > I'm not sure whether chars are meant to be signed or unsigned by
> > > default
> > 
> > The compiler is free to choose.
> 
> This was a disaster waiting to happen. I think it's time that we
> implement the following policy:
> 
> Use "char" for (text) strings but nothing else. Otherwise choose
> the one of "signed char" and "unsigned char" that makes most sense in
> the context. Where signedness is unimportant, use "signed char".

I have more or less completed this conversion, see the patches in ticket
31: http://trac.gnugo.org/gnugo/ticket/31. While doing this, I found
-Wconversion pretty helpful:

`-Wconversion'
     Warn if a prototype causes a type conversion that is different
     from what would happen to the same argument in the absence of a
     prototype.  This includes conversions of fixed point to floating
     and vice versa, and conversions changing the width or signedness
     of a fixed point argument except when the same as the default
     promotion.

     Also, warn if a negative integer constant expression is implicitly
     converted to an unsigned type.  For example, warn about the
     assignment `x = -1' if `x' is unsigned.  But do not warn about
     explicit casts like `(unsigned) -1'.

Does anyone see a reason not to set this for GNU Go? (After my changes,
GNU Go again compiles without warnings with -Wconversion included.)

Arend





reply via email to

[Prev in Thread] Current Thread [Next in Thread]