-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signed vs. unsigned flags types in winsock2 APIs #849
Comments
Transferring to win32metadata. |
So you'd prefer we remove the SEND_FLAGS enum and just use i32 constants for both send and recv, rather than introduce RECV_FLAGS and switch both enums to i32? |
I'd keep the enums and just ensure they are both i32 so no casting is necessary. (Note that the |
We can't have members with the same name across enums or that will also cause problems particularly for Rust. We probably need to keep loose constants here if some values are shared across both. |
Had a chat with @kennykerr and we settled on merging the two enums into a |
If that works for everybody, we can do that. |
0.36.0 of the |
Receive flag values such as
MSG_WAITALL
have typeu32
.The flags argument of the
recv
function it's meant to be passed to has typei32
.send
's flags argument has a dedicated type for itsflags
parameter calledSEND_FLAGS
.SEND_FLAGS
is au32
.The doc links above reference the latest version of windows-sys, which as of this post is 0.34.0.
In the POSIX specifications for
send
andrecv
, as well as thesend
andrecv
functions on all popularUnix-family platforms, the flags argument is
int
, which isi32
in practice. And inwinapi
it'si32
as well.In light of the above, the following would make the API more convenient:
recv
flag values should have the same type as therecv
's flags parameter so that the can be passed in without casting.send
's andrecv
's flags parameters should have the same type as it does on Unix-family platforms, to make it easier to write portable code.The text was updated successfully, but these errors were encountered: