gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] libboard and board.h


From: Arend Bayer
Subject: Re: [gnugo-devel] libboard and board.h
Date: Fri, 8 Aug 2003 00:19:29 +0200 (CEST)

On Thu, 7 Aug 2003, Gunnar Farneback wrote:

> Arend wrote:
> > I've made this change and posted a revised version of my patch as
> > arend_5_1.2a. It contains both the above change and the introduction
> > of defs.h. If someonce can voice an opinion on the latter, as this might
> > be a matter of taste, this would be welcome.
>
> The latter: ugly. :-)
Ok :-)
>
> > (In short: The main advantage I see is defining e.g. dragon status'
> > _and_ their names _and_ the number of dragon status' (for array sizes)
> > at one places. I hope it's not too much preprocessor magic.)
>
> Yes, I think it's too much magic. Doing it all in one place is a good
> idea but it should be possible to do a little bit simpler, like this:
>
> In .h:
>
> enum dragon_status {
>   DEAD,
>   ALIVE,
>   CRITICAL,
>   UNKNOWN,
>   UNCHECKED,
>   CAN_THREATEN_ATTACK,
>   CAN_THREATEN_DEFENSE,
> };
>
> #define DRAGON_STATUS_NAMES \
>   "dead", \
>   "alive", \
>   "critical", \
>   "unknown", \
>   "unchecked", \
>   "can_threaten_attack", \
>   "can_threaten_defense"
(...)

Ok.

I have one more suggestion to discuss: It would make sense to add
-Wconversion to avoid passing a safety value where a dragon status
is required, etc. (Note that we will, e.g., have to use different identifiers
for dragon status CRITICAL and safety value CRITICAL_S. Overall I think
this is an improvement over the current state.)
The downside is that we'd have to add a couple of explicit casts in calls
like mark_string(pos, goal, (char) 1).

Opinions?

Arend






reply via email to

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