From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- library/core/src/ffi/c_char.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 library/core/src/ffi/c_char.md (limited to 'library/core/src/ffi/c_char.md') diff --git a/library/core/src/ffi/c_char.md b/library/core/src/ffi/c_char.md new file mode 100644 index 000000000..b262a3663 --- /dev/null +++ b/library/core/src/ffi/c_char.md @@ -0,0 +1,8 @@ +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. On modern architectures this type will always be either [`i8`] or [`u8`], as they use byte-addresses memory with 8-bit bytes. + +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]: char -- cgit v1.2.3