Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: [FreeCiv-Cvs] vasc: Added cast to placate g++.
Home

[Freeciv-Dev] Re: [FreeCiv-Cvs] vasc: Added cast to placate g++.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [FreeCiv-Cvs] vasc: Added cast to placate g++.
From: Vasco Alexandre Da Silva Costa <vasc@xxxxxxxxxxxxxx>
Date: Wed, 13 Feb 2002 03:25:47 +0000 (WET)

On Tue, 12 Feb 2002, Raimar Falke wrote:

> A quick grep shows:
>   ./client/clinet.c:      struct server *pserver = (struct 
> server*)fc_malloc(sizeof(struct server));
> 
> plus stuff in amiga/, intl/ and client/gui-mui/. So this is only one
> "real hit".

Heh. Well, i guess my statement is still true nonetheless.

My point is making it valid C++ would make it easier to port to platforms
with C++ based APIs like BeOS (or god forbid it - MFC). I believe it would
make it easier for the people who want to do client ports. No C interfacing
would be required anymore.

Making it valid C++ wouldn't make it stop being C, it would just be IMHO a
nicety for future client development, or interfacing to other things in
the future. It doesn't clash with any other project goals, so as long as i
am not wasting anyone else's time, i don't see what is the problem.

> > Besides this, i think we should aim to make freeciv compileable with
> > a C++ compiler, just to keep our options open.
> 
> IMHO this isn't this useful because it is a huge difference between
> "compiles with a C++ compiler" and "is a C++ program". You can achieve
> the latter either by gradual replacing of constructs (like ObjectCiv
> has done, and died shortly afterwards after a "s/struct/class/" patch)
> or a rewrite from scratch. If I would like to make a C++ version of
> freeciv (this isn't my goal) I would do it from scratch. With a
> reasonable understanding of the problem domain you can get a good OO
> design.

Agreed. There should be a master design for such an endeavour. But this
isn't our purpose here (not mine at least).

> > K&R 2nd edition is a C book, and nonetheless all code contained
> > therein is valid C++.
> 
> I don't have the book but I would careful with such a statement. A
> variable named "new" or "bool" is enough.

The statement isn't mine: its from the authors themselves, i quote:

Preface:

"...We used Bjarne Stroustrup's C++ translator extensively for local
testing of our programs..."

Vague i know. But i guess they didn't want to be sued for any
typographical errors :-)

---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa



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