aboutsummaryrefslogtreecommitdiff
path: root/std/std.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2015-12-12 02:05:08 -0700
committerAndrew Kelley <superjoe30@gmail.com>2015-12-12 02:05:08 -0700
commitac630d354d51488d895bc14e26a069ae954ac5c6 (patch)
treeff99cc11334991a76d7ab0837112f00b8b1b0c3c /std/std.zig
parenta10277bd949d47370e427d4457d93e907de9a6f7 (diff)
downloadzig-ac630d354d51488d895bc14e26a069ae954ac5c6.tar.gz
zig-ac630d354d51488d895bc14e26a069ae954ac5c6.zip
std: print_str no longer requires length argument
add explicit casting support from array to string
Diffstat (limited to 'std/std.zig')
-rw-r--r--std/std.zig7
1 files changed, 2 insertions, 5 deletions
diff --git a/std/std.zig b/std/std.zig
index a05a21650f..ebb6e9e2b5 100644
--- a/std/std.zig
+++ b/std/std.zig
@@ -14,14 +14,11 @@ fn syscall3(number: isize, arg1: isize, arg2: isize, arg3: isize) -> isize {
}
// TODO error handling
-// TODO zig strings instead of C strings
// TODO handle buffering and flushing
// TODO non-i32 integer literals so we can remove the casts
// TODO constants for SYS_write and stdout_fileno
-//pub fn print_str(str : string) -> isize {
-pub fn print_str(str : *const u8, len: isize) -> isize {
+pub fn print_str(str : string) -> isize {
let SYS_write = 1;
let stdout_fileno = 1;
- //return syscall3(SYS_write as isize, stdout_fileno as isize, str.ptr as isize, str.len as isize);
- return syscall3(SYS_write as isize, stdout_fileno as isize, str as isize, len);
+ return syscall3(SYS_write as isize, stdout_fileno as isize, str.ptr as isize, str.len as isize);
}