mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 21:38:33 +00:00
std.io.parseUnsigned buf parameter is const
fixes padding in printf See #258
This commit is contained in:
parent
f7173f4f08
commit
ca180d3f02
@ -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) {
|
||||
|
||||
@ -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| {
|
||||
|
||||
@ -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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user