aboutsummaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-01-10 00:03:31 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-01-10 00:03:31 -0700
commit49d0971cd4f6aa3f897a0f36272c05c641e25f79 (patch)
tree38a52e168cbcf30efddb4b01f4431b4e5c19a30a /std
parent1fe1235e14cd599c1b3a6f079670b7cb7ea270d2 (diff)
downloadzig-49d0971cd4f6aa3f897a0f36272c05c641e25f79.tar.gz
zig-49d0971cd4f6aa3f897a0f36272c05c641e25f79.zip
detect and report top level decl dependency loop
Diffstat (limited to 'std')
-rw-r--r--std/rand.zig6
-rw-r--r--std/std.zig6
2 files changed, 4 insertions, 8 deletions
diff --git a/std/rand.zig b/std/rand.zig
index 46b3674929..637f34443d 100644
--- a/std/rand.zig
+++ b/std/rand.zig
@@ -3,10 +3,8 @@ const ARRAY_SIZE : u16 = 624;
/// Use `rand_init` to initialize this state.
pub struct Rand {
- // TODO use ARRAY_SIZE here
- array: [624]u32,
- // TODO use #typeof(ARRAY_SIZE) here
- index: u16,
+ array: [ARRAY_SIZE]u32,
+ index: #typeof(ARRAY_SIZE),
/// Initialize random state with the given seed.
pub fn init(r: &Rand, seed: u32) {
diff --git a/std/std.zig b/std/std.zig
index d42074a340..e1b66d9cb1 100644
--- a/std/std.zig
+++ b/std/std.zig
@@ -24,8 +24,7 @@ pub fn fprint_str(fd: isize, str: []const u8) -> isize {
// TODO handle buffering and flushing (mutex protected)
// TODO error handling
pub fn print_u64(x: u64) -> isize {
- // TODO use max_u64_base10_digits instead of hardcoding 20
- var buf: [20]u8;
+ var buf: [max_u64_base10_digits]u8;
const len = buf_print_u64(buf, x);
return write(stdout_fileno, buf.ptr, len);
}
@@ -33,8 +32,7 @@ pub fn print_u64(x: u64) -> isize {
// TODO handle buffering and flushing (mutex protected)
// TODO error handling
pub fn print_i64(x: i64) -> isize {
- // TODO use max_u64_base10_digits instead of hardcoding 20
- var buf: [20]u8;
+ var buf: [max_u64_base10_digits]u8;
const len = buf_print_i64(buf, x);
return write(stdout_fileno, buf.ptr, len);
}