45e72c0b39
* Fixed intToPtr to fn type * Added test * Import inttoptr.zig in behavior.zig
14 lines
353 B
Zig
14 lines
353 B
Zig
const builtin = @import("builtin");
|
|
const std = @import("std");
|
|
const assertOrPanic = std.debug.assertOrPanic;
|
|
|
|
test "casting random address to function pointer" {
|
|
randomAddressToFunction();
|
|
comptime randomAddressToFunction();
|
|
}
|
|
|
|
fn randomAddressToFunction() void {
|
|
var addr: usize = 0xdeadbeef;
|
|
var ptr = @intToPtr(fn () void, addr);
|
|
}
|