[Top][All Lists]
[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
- [gnugo-devel] libboard and board.h, Arend Bayer, 2003/08/03
- Re: [gnugo-devel] libboard and board.h, Inge Wallin, 2003/08/03
- Re: [gnugo-devel] libboard and board.h, Gunnar Farneback, 2003/08/05
- Re: [gnugo-devel] libboard and board.h, Arend Bayer, 2003/08/05
- Re: [gnugo-devel] libboard and board.h, Gunnar Farneback, 2003/08/06
- Re: [gnugo-devel] libboard and board.h,
Arend Bayer <=
- Re: [gnugo-devel] libboard and board.h, Arend Bayer, 2003/08/09
- Re: [gnugo-devel] libboard and board.h, Arend Bayer, 2003/08/10
- Re: [gnugo-devel] libboard and board.h, Arend Bayer, 2003/08/10
- Re: [gnugo-devel] libboard and board.h, SP LEE, 2003/08/20
- Re: [gnugo-devel] libboard and board.h, Gunnar Farneback, 2003/08/23