Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2003:
[Freeciv-Dev] Re: solaris warning
Home

[Freeciv-Dev] Re: solaris warning

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <per@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: solaris warning
From: Raimar Falke <rf13@xxxxxxxxxxxxxxxxx>
Date: Wed, 4 Jun 2003 00:09:12 +0200

On Thu, May 29, 2003 at 05:56:46PM +0000, Per I. Mathisen wrote:
> gcc -DHAVE_CONFIG_H -I. -I. -I.. -I../intl    -g -O2 -Werror -Wall
> -Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations
> -c `test -f 'netintf.c' || echo './'`netintf.c
> cc1: warnings being treated as errors
> netintf.c: In function `net_lookup_service':
> netintf.c:175: warning: cast increases required alignment of target type
> 
> Lines in question:
> 
>       struct sockaddr_in *sock = NULL;
> ...
>       sock = (struct sockaddr_in *) sa;
> 
> Any ideas?

Seems odd since sa is "struct sockaddr *". The standard says in
6.2.5.26:

      A pointer to void shall have the same representation and
      alignment requirements as a pointer to a character type.
      Similarly, pointers to qualified or unqualified versions of
      compatible types shall have the same representation and
      alignment requirements.

      All pointers to structure types shall have the same
      representation and alignment requirements as each other. 

      All pointers to union types shall have the same representation
      and alignment requirements as each other. Pointers to other
      types need not have the same representation or alignment
      requirements.


The middle part is quite clear IMHO.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Python 2.0 beta 1 is now available [...]. There is a long list of new 
  features since Python 1.6, released earlier today. We don't plan on 
  any new releases in the next 24 hours."
    -- Jeremy Hylton at Slashdot



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