[Top][All Lists]

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

Re: [gnugo-devel] Re: use of LOSE in reading.c

From: Arend Bayer
Subject: Re: [gnugo-devel] Re: use of LOSE in reading.c
Date: Sun, 22 Sep 2002 21:20:51 +0200 (CEST)

Teun wrote:

> My reason was that as a next stage I envisaged to introduce
> a new typedef (instead of #defines) for attack codes:
> typedef enum {LOSE=0, KO_B, KO_A, WIN} attack_code

Hmm, it is most certainly correct C, but I don't think it is very clear
and/or good style to do arithmetics "WIN - acode" with enum values; I
find this a bit more explicit with "#define WIN 5" etc.

> This as an extra safeguard (at no cost) against coding errors, similar
> to the asserts. Since the asserts have exposed so many bugs, I think
> enums could be similary useful.

I am certainly in favor of adding additional consistency checks. But I
doubt that a reading function would ever return an invalid return code,
they are pretty hardcoded everywhere.


reply via email to

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