[Freeciv-Dev] Re: (PR#13005) latest CVS (assertion failed, effects.c)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13005 >
On Sun, 8 May 2005, Jason Short wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=13005 >
>
> Vasco Alexandre da Silva Costa wrote:
> > <URL: http://bugs.freeciv.org/Ticket/Display.html?id=13005 >
> >
> > I suppose we could be using a different API though. The way this has
> > evolved, I think a single varargs function would be better. e.g.:
> >
> > int get_effect_bonus(enum effect_type effect_type, const char *fmt, ...)
> >
> > get_effect_bonus(EFT_HAVE_EMBASSIES, "p", pplayer)
> > -> get_player_bonus
> >
> > get_effect_bonus(EFT_MAKE_HAPPY, "c", pcity)
> > -> get_city_bonus
> >
> > get_effect_bonus(EFT_OUTPUT_ADD_TILE, "cto", pcity, ptile, poutput)
> > -> get_city_tile_output_bonus
> >
> > etc.
>
> Please no. You give away all typesafety and any hope at catching errors
> at compile time.
Are a zillion different functions better?
Other than variable arguments, I see no reasonable solution. If that is
the price, I say typesafety be damned.
You could do run-time checks of argument types if all the entities in the
game had a type field at the same offset. But that is probably a waste of
time.
Just be vewwy cawefwl when using it...
---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa
- [Freeciv-Dev] Re: (PR#13005) latest CVS (assertion failed, effects.c), Jason Short, 2005/05/08
- [Freeciv-Dev] Re: (PR#13005) latest CVS (assertion failed, effects.c), Vasco Alexandre da Silva Costa, 2005/05/08
- [Freeciv-Dev] Re: (PR#13005) latest CVS (assertion failed, effects.c), Vasco Alexandre da Silva Costa, 2005/05/08
- [Freeciv-Dev] (PR#13005) [PATCH] get_effect_bonus varargs, Vasco Alexandre da Silva Costa, 2005/05/08
- [Freeciv-Dev] Re: (PR#13005) latest CVS (assertion failed, effects.c), Jason Short, 2005/05/08
- [Freeciv-Dev] Re: (PR#13005) latest CVS (assertion failed, effects.c),
Vasco Alexandre da Silva Costa <=
- [Freeciv-Dev] Re: (PR#13005) latest CVS (assertion failed, effects.c), Jason Short, 2005/05/08
|
|