bsd sockets and gcc 4.0 not all happy in Tiger

Discussion in 'Mac Programming' started by superbovine, May 14, 2005.

  1. macrumors 68030

    superbovine

    Joined:
    Nov 7, 2003
    #1
    I have a project the crossed developed on os x and linux using gcc. Up till gcc 3.3 everything was fine and happy. When tiger came along with gcc 4.0 i started getting weird warnings, and the software has runtime errors with sockets. I have been using gcc_select to get by.

    With gcc 4.0 get these build errors.

    Code:
    comm.c: In function 'co1900_new_connection':
    comm.c:1798: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
    comm.c:1804: warning: pointer targets in passing argument 3 of 'accept' differ in signedness
    comm.c: In function 'co2000_new_descriptor':
    comm.c:1863: warning: pointer targets in passing argument 3 of 'getpeername' differ in signedness
    
    Code:
    1789: 	getsockname(s, (struct sockaddr *)&isa, &i);
    1804:    t = accept(s, (struct sockaddr *)&isa, &i);
    1863:    rc = getpeername(desc, (struct sockaddr *) &sock, &size);
    
    I know that this is limited information but any ideas as of to why gcc 4.0 doesn't like this lines well help.

    Also in a seperate project under the same situation happened with gcc 4.0 vs gcc 3.3 and bsd sockets.

    Code:
    gcc -c -g -O2 -Wall -DCIRCLE_IPV6 comm.c
    In file included from sysdep.h:268,
    from comm.c:14:
    /usr/include/sys/socket.h:99: error: two or more data types in declaration specifiers
    
     
  2. macrumors 65816

    broken_keyboard

    Joined:
    Apr 19, 2004
    Location:
    Secret Moon base
    #2
    Try changing your declaration of i from "int i" to "unsigned int i"

    It is complaining that you are passing a pointer to a signed type when the prototype requires unsigned (or vise versa).
     
  3. thread starter macrumors 68030

    superbovine

    Joined:
    Nov 7, 2003
    #3
    thanks that helped a lot. i have problem narrowed down to bind() now.
     

Share This Page