Sun Workshop warning
Matthias Andree
matthias.andree at gmx.de
Mon Aug 11 15:04:40 CEST 2003
David Relson <relson at osagesoftware.com> writes:
> At 06:50 AM 8/10/03, Matthias Andree wrote:
>>"src/main.c", line 157: warning: enum type mismatch: op "="
>
> Matthias,
>
> I've added a cast and committed the new version. That should make Sun
> Workshop happy.
The point is:
typedef enum rc_e { RC_SPAM = 0,
RC_HAM = 1,
RC_UNSURE = 2,
RC_OK,
RC_MORE } rc_t;
typedef enum ex_e { EX_SPAM = RC_SPAM,
EX_HAM = RC_HAM,
EX_UNSURE = RC_UNSURE,
EX_OK = 0,
EX_ERROR = 3 } ex_t;
We're assigning values of different types. This isn't safe and not
maintenance-friendly to do. The cast just conceals the problem so it's
hard to find later. We need to find a solution, not a workaround. I
don't know anything better than a) discarding one of these enum types or
b) explicit mapping in a function (array lookup or the switch you
mentioned) at the moment.
--
Matthias Andree
More information about the bogofilter-dev
mailing list