[Freeciv-Dev] Re: OO model for Freeciv?
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
>s += '.';
>
>What is the shortest way to express this in C?
s = strcat((char *)realloc(s , strlen(s) + 1), ".");
Convenience sometimes makes programmers unaware of the underlying
costs, results in less efficient codes.
Anybody know how to do this with g++?
enum tile_terrain_type {
T_ARCTIC, T_DESERT, T_FOREST, T_GRASSLAND, T_HILLS, T_JUNGLE,
T_MOUNTAINS, T_OCEAN, T_PLAINS, T_RIVER, T_SWAMP, T_TUNDRA, T_UNKNOWN,
T_LAST
};
char terrain_char[T_LAST] = {
[T_MOUNTAINS] 'm', [T_GRASSLAND] 'g', [T_UNKNOWN] 'u', [T_TUNDRA] 't',
[T_PLAINS] 'p', [T_JUNGLE] 'j', [T_FOREST] 'f', [T_DESERT] 'd',
[T_ARCTIC] 'a', [T_SWAMP] 's', [T_RIVER] 'r', [T_OCEAN] 'o', [T_HILLS] 'h',
};
Thanks.
Regards,
I.Q.
______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup
- [Freeciv-Dev] Re: OO model for Freeciv?, David Pfitzner, 2000/05/01
- [Freeciv-Dev] Re: OO model for Freeciv?, Jules Bean, 2000/05/01
- [Freeciv-Dev] Re: OO model for Freeciv?, Tony Stuckey, 2000/05/01
- [Freeciv-Dev] Re: OO model for Freeciv?, Florian Klein, 2000/05/01
- [Freeciv-Dev] Re: OO model for Freeciv?,
蔡恆華 <=
- [Freeciv-Dev] Re: OO model for Freeciv?, 蔡恆華, 2000/05/01
- [Freeciv-Dev] Re: OO model for Freeciv?, 蔡恆華, 2000/05/01
- [Freeciv-Dev] Re: OO model for Freeciv?, Peter Schaefer, 2000/05/02
- [Freeciv-Dev] Re: OO model for Freeciv?, Peter Schaefer, 2000/05/02
- [Freeciv-Dev] Re: OO model for Freeciv?, Dan Ward, 2000/05/02
|
|