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: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [FreeCiv-Cvs] vasc: Added cast to placate g++.
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 12 Feb 2002 09:14:41 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Mon, Feb 11, 2002 at 08:31:01PM -0800, freeciv@xxxxxxxxxxxxxxxxxxx wrote:
> This is an automated notification of a change to freeciv cvs, 
> on Mon Feb 11 20:22:28 PST 2002 = Tue Feb 12 04:22:29 2002 (GMT)
> by Vasco Alexandre da Silva Costa <vasc@xxxxxxxxxxxxxx>
> 
> ---- Files affected:
> 
> freeciv/common astring.c
> 
> ---- Log message:
> 
> Added cast to placate g++.

You made a lot of changes like this:

diff -X real_clean/diff_ignore -urd real_clean/common/astring.c 
freeciv.clean/common/astring.c
--- real_clean/common/astring.c Sun Feb 10 22:36:42 2002
+++ freeciv.clean/common/astring.c      Tue Feb 12 09:04:04 2002
@@ -76,7 +76,7 @@
   /* allocated more if this is only a small increase on before: */
   n1 = (3*(astr->n_alloc+10)) / 2;
   astr->n_alloc = (n > n1) ? n : n1;
-  astr->str = fc_realloc(astr->str, astr->n_alloc);
+  astr->str = (char *)fc_realloc(astr->str, astr->n_alloc);
 }

These are bad changes IMHO. Casting the return type of malloc is
unnecessary for plain C and it can mask errors like you forgot to
include "stdlib.h" (or "mem.h").

In short: freeciv is C and not C++ (were such casts are required).

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "It is not yet possible to change operating system by writing
  to /proc/sys/kernel/ostype."              sysctl(2) man page


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