Feature gate: #![feature(c_size_t)].
This is a tracking issue for std::os::raw::{c_size_t, c_ssize_t}, which are guaranteed to be the same size as the underlying C size_t and ssize_t types from stddef.h.
Currently, on all targets, this is equivalent to usize and isize, however Rust has historically gone somewhat out of its way to avoid promising this. There are some targets with vaguely-planned support where this is not true (W65, used for SNES homebrew, for example)
Further reading here is available:
And probably more.
Public API
// std::os::raw
pub type c_size_t = usize;
pub type c_ssize_t = isize;
Steps / History
Unresolved Questions
- Do we want to instead guarantee
usize and size_t are the same? See https://internals.rust-lang.org/t/pre-rfc-usize-is-not-size-t/15369
- Should this instead live in
libcore somehow, given that probably libstd may never support platforms where this is not true. (This may not be true, since I imagine CHERI will support libstd)
- Do we need both the signed and unsigned version, given that
size_t is more common in function signatures.
- ...
Feature gate:
#![feature(c_size_t)].This is a tracking issue for
std::os::raw::{c_size_t, c_ssize_t}, which are guaranteed to be the same size as the underlying Csize_tandssize_ttypes fromstddef.h.Currently, on all targets, this is equivalent to
usizeandisize, however Rust has historically gone somewhat out of its way to avoid promising this. There are some targets with vaguely-planned support where this is not true (W65, used for SNES homebrew, for example)Further reading here is available:
And probably more.
Public API
Steps / History
c_size_tandc_ssize_ttostd::os::raw. #88340Unresolved Questions
usizeandsize_tare the same? See https://internals.rust-lang.org/t/pre-rfc-usize-is-not-size-t/15369libcoresomehow, given that probablylibstdmay never support platforms where this is not true. (This may not be true, since I imagine CHERI will support libstd)size_tis more common in function signatures.