[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] libboard and board.h
From: |
Gunnar Farneback |
Subject: |
Re: [gnugo-devel] libboard and board.h |
Date: |
Thu, 07 Aug 2003 00:12:46 +0200 |
User-agent: |
EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode) |
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. :-)
> (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"
In .c:
static const char* status_names [] = {
DRAGON_STATUS_NAMES
};
Sure, your variant makes it almost impossible to get these out of sync
but I think this is good enough as long as they come together in the
file.
/Gunnar
- [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 <=
- Re: [gnugo-devel] libboard and board.h, Arend Bayer, 2003/08/07
- 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