mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 14:24:45 +00:00
fix shadowing
This commit is contained in:
parent
0fc66aa61d
commit
a37913ff01
1 changed files with 5 additions and 6 deletions
|
@ -302,17 +302,16 @@ fn strFromIntHelp(allocator: *Allocator, comptime T: type, int: T) RocStr {
|
|||
return RocStr.init(allocator, &buf, result.len);
|
||||
}
|
||||
|
||||
const c = @cImport({
|
||||
// See https://github.com/ziglang/zig/issues/515
|
||||
@cDefine("_NO_CRT_STDIO_INLINE", "1");
|
||||
@cInclude("stdio.h");
|
||||
});
|
||||
|
||||
// Str.fromFloat
|
||||
// When we actually use this in Roc, libc will be linked so we have access to std.heap.c_allocator
|
||||
pub fn strFromFloatC(float: f64) callconv(.C) RocStr {
|
||||
// NOTE the compiled zig for float formatting seems to use LLVM11-specific features
|
||||
// hopefully we can use zig instead of snprintf in the future when we upgrade
|
||||
const c = @cImport({
|
||||
// See https://github.com/ziglang/zig/issues/515
|
||||
@cDefine("_NO_CRT_STDIO_INLINE", "1");
|
||||
@cInclude("stdio.h");
|
||||
});
|
||||
var buf: [100]u8 = undefined;
|
||||
|
||||
const result = c.snprintf(&buf, 100, "%f", float);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue