Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2000:
[Freeciv-Dev] Re: OO model for Freeciv? (was: #define $#@$%! template)
Home

[Freeciv-Dev] Re: OO model for Freeciv? (was: #define $#@$%! template)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: OO model for Freeciv? (was: #define $#@$%! template)
From: Falk Hueffner <falk.hueffner@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: 30 Apr 2000 00:01:44 +0200

"Peter Schaefer" <schaefer@xxxxxx> writes:

> I personally dont like the C++ & STL; thats just me I guess; there
> are no warnings for more stupid mistakes than u can do in C.

Are you joking? With the STL, the compiler can check type consistency
at compile time; in C everything crashes silently if you push a city
into a list and pull a unit.

Also you don't have to care for memory managenment and the code is
shorter and more readable.

Using STL would be the #1 reason for me to use C++ for FreeCiv,
because container and string handling in C really sucks. For example,
if I want to add a '.' to a string, I write

s += '.';

What is the shortest way to express this in C?

char* newspace=(char*) malloc(strlen(s) + 1);
strcpy(s, newspace);
free(s);
s = newspace;
s[strlen(s) + 1] = '.';

or something.

Well, nevertheless I think we should stick to C :-) It's just that the
arguments here seem silly. For example, execution speed is pretty
irrelevant for FreeCiv IMHO, as long as it isn't twice as slow or
something.

        Falk





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