| ... | ... | @@ -2328,10 +2328,10 @@ const mem = std.mem; |
| 2328 | 2328 | const fmt = std.fmt; |
| 2329 | 2329 | |
| 2330 | 2330 | test "using slices for strings" { |
| 2331 | | // Zig has no concept of strings. String literals are const pointers to |
| 2332 | | // arrays of u8, and by convention parameters that are "strings" are |
| 2333 | | // expected to be UTF-8 encoded slices of u8. |
| 2334 | | // Here we coerce [5]u8 to []const u8 |
| 2331 | // Zig has no concept of strings. String literals are const pointers |
| 2332 | // to null-terminated arrays of u8, and by convention parameters |
| 2333 | // that are "strings" are expected to be UTF-8 encoded slices of u8. |
| 2334 | // Here we coerce *const [5:0]u8 and *const [6:0]u8 to []const u8 |
| 2335 | 2335 | const hello: []const u8 = "hello"; |
| 2336 | 2336 | const world: []const u8 = "世界"; |
| 2337 | 2337 | |