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: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: jdorje@xxxxxxxxxxxxxxxxxxxxx, <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Economy report (PR#1307)
From: Ben Webb <ben@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 8 Mar 2002 17:13:21 +0000 (GMT)

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. ;)

"Ice formed on the butler's upper slopes."
        - 'Pigs Have Wings (1952), ch. 5, pt. i', P.G. Wodehouse

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