Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] Re: Economy report (PR#1307)

[Freeciv-Dev] Re: Economy report (PR#1307)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Ben Webb <ben@xxxxxxxxxxxxxxxxxxxxxx>
Cc: jdorje@xxxxxxxxxxxxxxxxxxxxx, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Economy report (PR#1307)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 8 Mar 2002 18:26:06 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Fri, Mar 08, 2002 at 05:13:21PM +0000, Ben Webb wrote:
> On Fri, 8 Mar 2002, Raimar Falke wrote:
> > I get some of these:
> >   warning: cast increases required alignment of target type
>       Well, the Alpha has pretty restrictive alignment when compared to 
> x86. (I should point out that this is a completely different issue to my 
> patch, though, which addresses the fact that sizeof(int) != sizeof(char *) 
> on Alpha.)
> > If I understand this correct you shouldn't do
> >  char *p;
> >  int *q;
> >  void *r;
> > 
> >  q=(int *)p;
> > 
> > Since q may have stronger alignment requirements than p. Note that
> >  q=r;
> > is ok. So we have to change the type of a generic pointer from char *
> > to void *. Correct?!
>       I'm not an expert, but I believe the usual approach is to use the 
> pointer type with the most restrictive alignment - usually (double *). 
> Either that, or don't compile with -Wcast-align. ;)

You will get segv on Alpha ;) 

But the serialize/unserialize code in attribute.c is bad. A lot of
wild casts which could break pretty fast on Alpha.


 email: rf13@xxxxxxxxxxxxxxxxx
 "The two rules for success in life are:
  1) Never tell them everything you know."

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