Open
Description
Currently the compiler automatically converts a str
to its pointer when passing it to a C-style vararg function (eg. printf
) (see
Line 193 in 8402c46
Of course this kinda defeats the purpose, since slices are not necessarily null-terminated. The proposed alternative (which I'm proposing now) is to pass the entire struct to printf
, which will cause it to get both the length and the pointer.
(aside: the layout of str
is like this: struct str { len: i64; ptr: &i8 }
)
Then, we would need to call printf
with %.*s
instead of just %s
.