There was a patch made to _ip_types.h and winsock.h in 2012 that I wish had 
been made differently.  All the function prototypes using timeval* were changed 
to use PTIMEVAL.  I think it would have been better to change the typedef for 
'timeval' for LP64 instead.

I'm working with a library, which, for better or for worse, uses a cast for the 
final argument in 'select'.  So with -Wall, the code:

#include <time.h>
#include <windows.h>

void sub()
{
    struct timeval tv;

    select(0, 0, 0, 0, (const struct timeval *)&tv);
}

gets a warning:

tt.c: In function 'sub':
tt.c:8:24: warning: passing argument 5 of 'select' discards 'const' qualifier 
from pointer target type [-Wdiscarded-qualifiers]
     select(0, 0, 0, 0, (const struct timeval *)&tv);
                        ^
In file included from 
C:/TDM-GCC-64-5.1.0-2/x86_64-w64-mingw32/include/windows.h:92:0,
                 from tt.c:2:
C:/TDM-GCC-64-5.1.0-2/x86_64-w64-mingw32/include/winsock.h:299:34: note: 
expected 'PTIMEVAL {aka struct timeval * const}' but argument is of type 'const 
struct timeval *'
   WINSOCK_API_LINKAGE int WSAAPI select(int nfds,fd_set *readfds,fd_set 
*writefds,fd_set *exceptfds,const PTIMEVAL timeout);
    
'gcc' has never been good enough to treat "equal" type declarations as the 
"same" when checking for this sort of error.

------------------------------------------------------------------------------
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to