commit ca180d3f02914d282505752a1d2fe08e175f9d99 (tree)
parent f7173f4f081bdc200732cc9f7d58d3d54f9b0205
Author: Andrew Kelley <superjoe30@gmail.com>
Date: Sat, 11 Feb 2017 15:06:20 -0500
std.io.parseUnsigned buf parameter is const
fixes padding in printf
See #258
Diffstat:
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/analyze.cpp b/src/analyze.cpp
@@ -3302,7 +3302,7 @@ bool ir_get_var_is_comptime(VariableTableEntry *var) {
}
bool const_values_equal(ConstExprValue *a, ConstExprValue *b) {
- assert(a->type == b->type);
+ assert(a->type->id == b->type->id);
assert(a->special == ConstValSpecialStatic);
assert(b->special == ConstValSpecialStatic);
switch (a->type->id) {
diff --git a/std/io.zig b/std/io.zig
@@ -469,7 +469,7 @@ pub const InStream = struct {
}
};
-pub fn parseUnsigned(comptime T: type, buf: []u8, radix: u8) -> %T {
+pub fn parseUnsigned(comptime T: type, buf: []const u8, radix: u8) -> %T {
var x: T = 0;
for (buf) |c| {
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
@@ -319,9 +319,9 @@ pub const b_text = a_text;
const io = @import("std").io;
pub fn main(args: [][]u8) -> %void {
- %%io.stdout.printf("Hello, world!\n");
+ %%io.stdout.printf("Hello, world!\n{d4} {x3}\n", u32(12), u16(0x12));
}
- )SOURCE", "Hello, world!\n");
+ )SOURCE", "Hello, world!\n0012 012\n");
add_simple_case_libc("number literals", R"SOURCE(