You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where the only difference is the const property on the iov_base field. This is done so that e.g. functions that don't modify their arguments (like writev) can take a [*]iovec_const, but functions that modify their arguments (like readv) take an [*]iovec.
However this gets extended: sendmsg/recvmsg take a msghdr which not only has a msg_iov member different that points to the relevant iovec, but the field msg_name gains a const across non-const/const variants.
From IRC today: why isn't const sometype a valid type?
That would remove the requirement for both the e.g. mem.toSlice and mem.toSliceConst variants.
Idea:
const T is a type that has the same layout as T, but all child indirections are const-ified.
e.g. using the example in the original post, iovec_const = const iovec; and msghdr_const = const msghdr would be equivalent to the definitions given.
andrewrk
added
the
proposal
This issue suggests modifications. If it also has the "accepted" label then it is planned.
label
Jan 5, 2020
The idea proposed earlier seems like a bad idea. It's propagating const to types pointers point to. I think that's wrong, because just because you don't want the pointer to be modifiable doesn't mean you also don't want the pointed to data to be modifiable. And same the other way around. You can have a modifiable pointer that points to constant data.
However, this does seem related to an issue I ran into. #6897
As noted in #2326: we have both
and
Where the only difference is the
const
property on theiov_base
field. This is done so that e.g. functions that don't modify their arguments (likewritev
) can take a[*]iovec_const
, but functions that modify their arguments (likereadv
) take an[*]iovec
.However this gets extended:
sendmsg
/recvmsg
take amsghdr
which not only has amsg_iov
member different that points to the relevantiovec
, but the fieldmsg_name
gains aconst
across non-const/const variants.The text was updated successfully, but these errors were encountered: