Revisions suggested in comments
This commit is contained in:
@@ -2,7 +2,7 @@ Equivalent to C's `char` type.
|
||||
|
||||
[C's `char` type] is completely unlike [Rust's `char` type]; while Rust's type represents a unicode scalar value, C's `char` type is just an ordinary integer. In practice, this type will always be either [`i8`] or [`u8`], but you're technically not supposed to rely on this behaviour, as the standard only defines a char as being at least eight bits long.
|
||||
|
||||
C chars are most commonly used to make C strings. Unlike Rust, where the length of a string is included alongside the string, C strings mark the end of a string with a zero. See [`CStr`] for more information.
|
||||
C chars are most commonly used to make C strings. Unlike Rust, where the length of a string is included alongside the string, C strings mark the end of a string with the character `'\0'`. See [`CStr`] for more information.
|
||||
|
||||
[C's `char` type]: https://en.wikipedia.org/wiki/C_data_types#Basic_types
|
||||
[Rust's `char` type]: ../../primitive.char.html
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
Equivalent to C's `signed long` (`long`) type.
|
||||
|
||||
This type will usually be [`i64`], but is sometimes [`i32`] \(i.e. [`isize`]\) on 32-bit systems. Technically, the standard only requires that it be at least 32 bits, or at least the size of an [`int`].
|
||||
This type will usually be [`i64`], but is sometimes [`i32`]. Technically, the standard only requires that it be at least 32 bits, or at least the size of an [`int`].
|
||||
|
||||
[`int`]: type.c_int.html
|
||||
[`i32`]: ../../primitive.i32.html
|
||||
[`i64`]: ../../primitive.i64.html
|
||||
[`isize`]: ../../primitive.isize.html
|
||||
|
||||
@@ -83,7 +83,7 @@ use fmt;
|
||||
/// and `*mut c_void` is equivalent to C's `void*`. That said, this is
|
||||
/// *not* the same as C's `void` return type, which is Rust's `()` type.
|
||||
///
|
||||
/// [pointer]: ../primitive.pointer.html
|
||||
/// [pointer]: ../../primitive.pointer.html
|
||||
// NB: For LLVM to recognize the void pointer type and by extension
|
||||
// functions like malloc(), we need to have it represented as i8* in
|
||||
// LLVM bitcode. The enum used here ensures this and prevents misuse
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
Equivalent to C's `unsigned long` type.
|
||||
|
||||
This type will usually be [`u64`], but is sometimes [`u32`] \(i.e. [`usize`]\) on 32-bit systems. Technically, the standard only requires that it be the same size as a [`long`], which isn't very clear-cut.
|
||||
This type will usually be [`u64`], but is sometimes [`u32`]. Technically, the standard only requires that it be the same size as a [`long`], which isn't very clear-cut.
|
||||
|
||||
[`long`]: type.c_long.html
|
||||
[`u32`]: ../../primitive.u32.html
|
||||
[`u64`]: ../../primitive.u64.html
|
||||
[`usize`]: ../../primitive.usize.html
|
||||
|
||||
Reference in New Issue
Block a user