From 184c56288a63f776f906b2bdf9c0d00cc4c36d04 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 11 Mar 2026 13:43:34 +0300 Subject: [PATCH] docs: clarify mapping of i8 to C char (fixes #24009) --- doc/c_and_v_type_interoperability.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/c_and_v_type_interoperability.md b/doc/c_and_v_type_interoperability.md index 63c35d9bc..0468e073e 100644 --- a/doc/c_and_v_type_interoperability.md +++ b/doc/c_and_v_type_interoperability.md @@ -5,7 +5,7 @@ ## Number types in C and V: -* A V `i8` is equivalent to C `char`, or `int8_t`. +* A V `i8` is equivalent to C `signed char`, or `int8_t`. * A V `i16` is equivalent to C `short`, or `int16_t`. * A V `i32` is equivalent to C `int`, or `int32_t`. * A V `i64` is equivalent to C `long`, or `int64_t`. @@ -18,6 +18,10 @@ * A V `f32` is equivalent to C `float`. * A V `f64` is equivalent to C `double`. +`char` in C is a distinct type with implementation-defined signedness, so use +V `char`, `&char`, or `charptr` when you need to match C `char`, `char*`, +or `char**`. + * A V `isize` is equivalent to C `ssize_t`. It is a signed integer, and `isize` is guaranteed to be at least 16 bits. It is 32 bit on 32 bit platforms, and 64 bits on 64 bit ones. @@ -111,7 +115,7 @@ For example, these functions have equivalent types: fn v_function(a u64, b i8) (i32, f32) ``` ```c ignore -struct { int i; float f; } c_function(unsigned long a, char b); +struct { int i; float f; } c_function(unsigned long a, signed char b); ```` A pointer to a V function is equivalent to a pointer to a C function, when the -- 2.39.5