winsock + DSTRICT

Martin Wilck Martin.Wilck at
Tue Oct 29 07:00:19 CST 2002

Michael Stefaniuc wrote:

> i'm not sure if the compiler will optimize away the assert
> from __handle2socket on machines where sizeof(HANDLE) = 
> sizeof(SOCKET).

gcc does optimize this away if the function is declared inline, checked
that. The assert is used only when new sockets are allocated
(i.e. only in socket() and accept() calls), it is certainly not

Alexandre Julliard wrote:

> The assert is useless anyway. Even if the types have different sizes
> you'll need to allocate a billion handles to trigger it.

If _you_ say that - I didn't feel bold enough to argue that way :-)

> It's much
> better to use a simple cast (without ULONG_PTR) so the compiler will
> warn if the pointer and integer are different sizes.

If you really want a compiler warning rather than a runtime error, OK.

Perhaps someone could check if SOCKET is really a 32bit type on 64bit


Martin Wilck                Phone: +49 5251 8 15113
Fujitsu Siemens Computers   Fax:   +49 5251 8 20409
Heinz-Nixdorf-Ring 1	    mailto:Martin.Wilck at
D-33106 Paderborn 

More information about the wine-devel mailing list